/V1/trunk/Source/StockTraderRI/StockTraderRI.Modules.WatchList.Tests/Mocks/MockEventAggregator.cs
C# | 37 lines | 18 code | 3 blank | 16 comment | 0 complexity | 3a338bc490be2556adc294c9cf04b447 MD5 | raw file
- //===============================================================================
- // Microsoft patterns & practices
- // Composite Application Guidance for Windows Presentation Foundation
- //===============================================================================
- // Copyright (c) Microsoft Corporation. All rights reserved.
- // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
- // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
- // LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- // FITNESS FOR A PARTICULAR PURPOSE.
- //===============================================================================
- // The example companies, organizations, products, domain names,
- // e-mail addresses, logos, people, places, and events depicted
- // herein are fictitious. No association with any real company,
- // organization, product, domain name, email address, logo, person,
- // places, or events is intended or should be inferred.
- //===============================================================================
-
- using System;
- using System.Collections.Generic;
- using Microsoft.Practices.Composite.Events;
-
- namespace StockTraderRI.Modules.WatchList.Tests.Mocks
- {
- public class MockEventAggregator : IEventAggregator
- {
- Dictionary<Type, object> events = new Dictionary<Type, object>();
- public TEventType GetEvent<TEventType>() where TEventType : EventBase
- {
- return (TEventType)events[typeof(TEventType)];
- }
-
- public void AddMapping<TEventType>(TEventType mockEvent)
- {
- events.Add(typeof(TEventType), mockEvent);
- }
- }
- }