PageRenderTime 18ms CodeModel.GetById 15ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/V4/PrismLibrary/Desktop/Prism.Tests/Events/EventAggregatorFixture.cs

#
C# | 39 lines | 18 code | 5 blank | 16 comment | 0 complexity | 3b7c90dba06580357b5f9b0a607b4156 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.Prism.Events;
18using Microsoft.VisualStudio.TestTools.UnitTesting;
19
20namespace Microsoft.Practices.Prism.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        public class MockEventBase : EventBase { }
36    }
37
38
39}