PageRenderTime 26ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/V4/PrismLibrary/Desktop/Prism.MefExtensions.Tests/BootstrapperFixtureBase.cs

#
C# | 47 lines | 28 code | 2 blank | 17 comment | 1 complexity | b4668f95e03f532a1a94ad0d517ed874 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 System;
  18. using Microsoft.Practices.Prism;
  19. using Microsoft.VisualStudio.TestTools.UnitTesting;
  20. namespace Microsoft.Practices.Prism.MefExtensions.Tests
  21. {
  22. [TestClass]
  23. public class BootstrapperFixtureBase
  24. {
  25. // TODO: Move to shared DLL
  26. protected static void AssertExceptionThrownOnRun(Bootstrapper bootstrapper, Type expectedExceptionType, string expectedExceptionMessageSubstring)
  27. {
  28. bool exceptionThrown = false;
  29. try
  30. {
  31. bootstrapper.Run();
  32. }
  33. catch (Exception ex)
  34. {
  35. Assert.AreEqual(expectedExceptionType, ex.GetType());
  36. StringAssert.Contains(ex.Message, expectedExceptionMessageSubstring);
  37. exceptionThrown = true;
  38. }
  39. if (!exceptionThrown)
  40. {
  41. Assert.Fail("Exception not thrown.");
  42. }
  43. }
  44. }
  45. }