コード例 #1
0
        public void Test_RegisterInstance_ShouldRegister()
        {
            //---------------Set up test pack-------------------
            BOTestFactoryRegistry registry            = new BOTestFactoryRegistry();
            BOTestFactoryFakeBO   boTestFactoryFakeBO = new BOTestFactoryFakeBO();

            //---------------Assert Precondition----------------
            registry.Register <FakeBO>(boTestFactoryFakeBO);
            //---------------Execute Test ----------------------
            BOTestFactory boTestFactory = registry.Resolve <FakeBO>();

            Assert.AreSame(boTestFactoryFakeBO, boTestFactory);
        }
コード例 #2
0
        public void Test_RegisterTwice_WhenInstanceThenType_ShouldStoreSecond()
        {
            //---------------Set up test pack-------------------
            BOTestFactoryRegistry registry    = new BOTestFactoryRegistry();
            BOTestFactoryFakeBO   origFactory = new BOTestFactoryFakeBO();

            registry.Register <FakeBO>(origFactory);
            //---------------Assert Precondition----------------
            Assert.IsNotNull(registry.Resolve <FakeBO>());
            //---------------Execute Test ----------------------
            registry.Register <FakeBO, BOTestFactory <FakeBO> >();
            BOTestFactory boTestFactory = registry.Resolve <FakeBO>();

            Assert.AreNotSame(origFactory, boTestFactory);
        }
コード例 #3
0
 public void Test_RegisterTwice_WhenTypeThenInstance_ShouldStoreSecond()
 {
     //---------------Set up test pack-------------------
     BOTestFactoryRegistry registry = new BOTestFactoryRegistry();
     registry.Register<FakeBO, BOTestFactory<FakeBO>>();
     //---------------Assert Precondition----------------
     Assert.IsNotNull(registry.Resolve<FakeBO>());
     BOTestFactoryFakeBO secondFactory = new BOTestFactoryFakeBO();
     //---------------Execute Test ----------------------
     registry.Register<FakeBO>(secondFactory);
     BOTestFactory boTestFactory = registry.Resolve<FakeBO>();
     Assert.AreSame(secondFactory, boTestFactory);
 }
コード例 #4
0
 public void Test_RegisterInstance_ShouldRegister()
 {
     //---------------Set up test pack-------------------
     BOTestFactoryRegistry registry = new BOTestFactoryRegistry();
     BOTestFactoryFakeBO boTestFactoryFakeBO = new BOTestFactoryFakeBO();
     //---------------Assert Precondition----------------
     registry.Register<FakeBO>(boTestFactoryFakeBO);
     //---------------Execute Test ----------------------
     BOTestFactory boTestFactory = registry.Resolve<FakeBO>();
     Assert.AreSame(boTestFactoryFakeBO, boTestFactory);
 }