コード例 #1
0
        public void ShouldConstructAnObjectThatHasInterfacesForCDsByInstantiatingDependenciesIfTheyAreNotRegistered()
        {
            TestClassWithInterfaceDependencies constructed = (TestClassWithInterfaceDependencies)store.GetByType(typeof(TestClassWithInterfaceDependencies));

            Assert.IsNotNull(constructed);
            Assert.IsNotNull(constructed.Dependency);
        }
コード例 #2
0
        public void ShouldConstructAnObjectThatHasInterfacesForCDsByUsingRegisteredInstancesIfTheyAreRegistered()
        {
            TestClass dependency = new TestClass();

            store.AddInstanceForType(typeof(TestInterface), dependency);
            TestClassWithInterfaceDependencies constructed = (TestClassWithInterfaceDependencies)store.GetByType(typeof(TestClassWithInterfaceDependencies));

            Assert.IsNotNull(constructed);
            Assert.IsNotNull(constructed.Dependency);
        }