/V4/PrismLibrary/Desktop/Prism.UnityExtensions.Tests/UnityBootstrapperNullContainerFixture.cs

# · C# · 53 lines · 33 code · 4 blank · 16 comment · 0 complexity · 36b682fd16c11f6048a70ae906f8b020 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 System.Windows;
  19. using Microsoft.Practices.Prism.UnityExtensions;
  20. using Microsoft.Practices.Unity;
  21. using Microsoft.VisualStudio.TestTools.UnitTesting;
  22. namespace Microsoft.Practices.Prism.UnityExtensions.Tests
  23. {
  24. [TestClass]
  25. public class UnityBootstrapperNullContainerFixture : BootstrapperFixtureBase
  26. {
  27. [TestMethod]
  28. public void RunThrowsWhenNullContainerCreated()
  29. {
  30. var bootstrapper = new NullContainerBootstrapper();
  31. AssertExceptionThrownOnRun(bootstrapper, typeof(InvalidOperationException), "IUnityContainer");
  32. }
  33. private class NullContainerBootstrapper : UnityBootstrapper
  34. {
  35. protected override IUnityContainer CreateContainer()
  36. {
  37. return null;
  38. }
  39. protected override DependencyObject CreateShell()
  40. {
  41. throw new NotImplementedException();
  42. }
  43. protected override void InitializeShell()
  44. {
  45. throw new NotImplementedException();
  46. }
  47. }
  48. }
  49. }