PageRenderTime 45ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
C# | 54 lines | 33 code | 5 blank | 16 comment | 0 complexity | 09473544dd6d4602ce8954148c508ed5 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.ComponentModel.Composition.Hosting;
  19. using System.Windows;
  20. using Microsoft.Practices.Prism.MefExtensions;
  21. using Microsoft.VisualStudio.TestTools.UnitTesting;
  22. namespace Microsoft.Practices.Prism.MefExtensions.Tests
  23. {
  24. [TestClass]
  25. public class MefNullContainerBootstrapperFixture : BootstrapperFixtureBase
  26. {
  27. [TestMethod]
  28. public void RunThrowsWhenNullContainerCreated()
  29. {
  30. var bootstrapper = new NullContainerBootstrapper();
  31. AssertExceptionThrownOnRun(bootstrapper, typeof(InvalidOperationException), "CompositionContainer");
  32. }
  33. internal class NullContainerBootstrapper : MefBootstrapper
  34. {
  35. protected override CompositionContainer 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. }