/V4/PrismLibrary/Desktop/Prism.MefExtensions.Tests/BootstrapperFixtureBase.cs
C# | 47 lines | 28 code | 2 blank | 17 comment | 1 complexity | b4668f95e03f532a1a94ad0d517ed874 MD5 | raw file
- //===================================================================================
- // Microsoft patterns & practices
- // Composite Application Guidance for Windows Presentation Foundation and Silverlight
- //===================================================================================
- // 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 Microsoft.Practices.Prism;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
-
- namespace Microsoft.Practices.Prism.MefExtensions.Tests
- {
- [TestClass]
- public class BootstrapperFixtureBase
- {
- // TODO: Move to shared DLL
- protected static void AssertExceptionThrownOnRun(Bootstrapper bootstrapper, Type expectedExceptionType, string expectedExceptionMessageSubstring)
- {
- bool exceptionThrown = false;
- try
- {
- bootstrapper.Run();
- }
- catch (Exception ex)
- {
- Assert.AreEqual(expectedExceptionType, ex.GetType());
- StringAssert.Contains(ex.Message, expectedExceptionMessageSubstring);
- exceptionThrown = true;
- }
-
- if (!exceptionThrown)
- {
- Assert.Fail("Exception not thrown.");
- }
- }
- }
- }