PageRenderTime 22ms CodeModel.GetById 14ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/V2.2/trunk/CAL/Desktop/Composite.Tests/Events/EventAggregatorFixture.cs

#
C# | 39 lines | 18 code | 5 blank | 16 comment | 0 complexity | a14d2319fa87da35b62dbe6ac4db06c4 MD5 | raw file
 1//===================================================================================
 2// Microsoft patterns & practices
 3// Composite Application Guidance for Windows Presentation Foundation and Silverlight
 4//===================================================================================
 5// Copyright (c) Microsoft Corporation.  All rights reserved.
 6// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
 7// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
 8// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 9// FITNESS FOR A PARTICULAR PURPOSE.
10//===================================================================================
11// The example companies, organizations, products, domain names,
12// e-mail addresses, logos, people, places, and events depicted
13// herein are fictitious.  No association with any real company,
14// organization, product, domain name, email address, logo, person,
15// places, or events is intended or should be inferred.
16//===================================================================================
17using Microsoft.Practices.Composite.Events;
18using Microsoft.VisualStudio.TestTools.UnitTesting;
19
20namespace Microsoft.Practices.Composite.Tests.Events
21{
22    [TestClass]
23    public class EventAggregatorFixture
24    {
25        [TestMethod]
26        public void GetReturnsSingleInstancesOfSameEventType()
27        {
28            var eventAggregator = new EventAggregator();
29            var instance1 = eventAggregator.GetEvent<MockEventBase>();
30            var instance2 = eventAggregator.GetEvent<MockEventBase>();
31
32            Assert.AreSame(instance2, instance1);
33        }
34
35        class MockEventBase : EventBase { }
36    }
37
38
39}