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

            Assert.IsTrue(extension.InitializeWasCalled);
        }
Ejemplo 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);
        }
Ejemplo 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);
 }
Ejemplo 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);
        }