Esempio n. 1
0
        public void Ext_ContainerCallsExtensionsInitializeMethod()
        {
            MockContainerExtension extension = new MockContainerExtension();
            IUnityContainer container = new UnityContainer();
            container.AddExtension(extension);

            Assert.IsTrue(extension.InitializeWasCalled);
        }
Esempio n. 2
0
        public void Ext_ReceivesExtensionContextInInitialize()
        {
            MockContainerExtension extension = new MockContainerExtension();
            IUnityContainer container = new UnityContainer();
            container.AddExtension(extension);

            Assert.IsNotNull(extension.Context);
            Assert.AreSame(container, extension.Context.Container);
        }
Esempio n. 3
0
 public void Ext_CanGetConfigurationWithoutGenericMethod()
 {
     MockContainerExtension extension = new MockContainerExtension();
     IUnityContainer container = new UnityContainer()
         .AddExtension(extension);
     IMockConfiguration config = (IMockConfiguration)container.Configure(typeof(IMockConfiguration));
     
     Assert.AreSame(extension, config);
     Assert.AreSame(container, config.Container);
 }
Esempio n. 4
0
        public void Ext_CanGetConfigurationInterfaceFromExtension()
        {
            MockContainerExtension extension = new MockContainerExtension();
            IUnityContainer container = new UnityContainer()
                .AddExtension(extension);
            IMockConfiguration config = container.Configure<IMockConfiguration>();

            Assert.AreSame(extension, config);
            Assert.AreSame(container, config.Container);
        }