PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 0ms 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. //===================================================================================
  17. using Microsoft.Practices.Prism.Events;
  18. using Microsoft.VisualStudio.TestTools.UnitTesting;
  19. namespace Microsoft.Practices.Prism.Tests.Events
  20. {
  21. [TestClass]
  22. public class EventAggregatorFixture
  23. {
  24. [TestMethod]
  25. public void GetReturnsSingleInstancesOfSameEventType()
  26. {
  27. var eventAggregator = new EventAggregator();
  28. var instance1 = eventAggregator.GetEvent<MockEventBase>();
  29. var instance2 = eventAggregator.GetEvent<MockEventBase>();
  30. Assert.AreSame(instance2, instance1);
  31. }
  32. public class MockEventBase : EventBase { }
  33. }
  34. }