public void Test_RegisterTwice_ShouldStoreSecond()
        {
            //---------------Set up test pack-------------------
            BOTestFactoryRegistry registry = new BOTestFactoryRegistry();

            registry.Register <FakeBO, BOTestFactoryFakeBO>();
            //---------------Assert Precondition----------------
            Assert.IsNotNull(registry.Resolve <FakeBO>());
            //---------------Execute Test ----------------------
            registry.Register <FakeBO, BOTestFactory <FakeBO> >();
            Assert.IsNotInstanceOf <BOTestFactoryFakeBO>(registry.Resolve <FakeBO>());
        }
        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);
        }
        public void Test_RegisterCustomBOTestFactory_ShouldReturnWhenResolved()
        {
            //---------------Set up test pack-------------------
            BOTestFactoryRegistry registry = new BOTestFactoryRegistry();

            //---------------Assert Precondition----------------
            registry.Register <FakeBO, BOTestFactoryFakeBO>();
            //---------------Execute Test ----------------------
            Assert.IsInstanceOf <BOTestFactoryFakeBO>(registry.Resolve <FakeBO>());
        }
 public void Test_Register_WhenCustomBOTestFactory_WithFactoryType_ShouldReturnWhenResolved()
 {
     //---------------Set up test pack-------------------
     BOTestFactoryRegistry registry = new BOTestFactoryRegistry();
     registry.Register<FakeBO>(typeof(BOTestFactoryFakeBO));
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     BOTestFactory boTestFactory = registry.Resolve<FakeBO>();
     //---------------Test Result -----------------------
     Assert.IsInstanceOf<BOTestFactoryFakeBO>(boTestFactory);
 }
        public void Test_Register_WhenCustomBOTestFactory_WithFactoryType_ShouldReturnWhenResolved()
        {
            //---------------Set up test pack-------------------
            BOTestFactoryRegistry registry = new BOTestFactoryRegistry();

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

            //---------------Test Result -----------------------
            Assert.IsInstanceOf <BOTestFactoryFakeBO>(boTestFactory);
        }
        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);
        }
        public void Test_Register_WhenNotFactoryType_ShouldThrowError()
        {
            //---------------Set up test pack-------------------
            BOTestFactoryRegistry registry = new BOTestFactoryRegistry();

            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            try
            {
                registry.Register <FakeBO>(typeof(RelatedFakeBo));
                Assert.Fail("Expected to throw an HabaneroApplicationException");
            }
            catch (HabaneroApplicationException ex)
            {
                StringAssert.Contains("A BOTestFactory is being Registered for '", ex.Message);
                StringAssert.Contains("is not of Type BOTestFactory", ex.Message);
            }
        }
 public void Test_Register_WhenFactoryTypeNull_ShouldThrowError()
 {
     //---------------Set up test pack-------------------
     BOTestFactoryRegistry registry = new BOTestFactoryRegistry();
     //---------------Assert Precondition----------------
     Type factoryType = null;
     //---------------Execute Test ----------------------
     try
     {
         registry.Register<FakeBO>(factoryType);
         Assert.Fail("Expected to throw an HabaneroApplicationException");
     }
     catch (HabaneroApplicationException ex)
     {
         StringAssert.Contains("A BOTestFactory is being Registered for '", ex.Message);
         StringAssert.Contains("but the BOTestFactory is Null", ex.Message);
     }
 }
        public void Test_Register_WhenFactoryTypeNull_ShouldThrowError()
        {
            //---------------Set up test pack-------------------
            BOTestFactoryRegistry registry = new BOTestFactoryRegistry();
            //---------------Assert Precondition----------------
            Type factoryType = null;

            //---------------Execute Test ----------------------
            try
            {
                registry.Register <FakeBO>(factoryType);
                Assert.Fail("Expected to throw an HabaneroApplicationException");
            }
            catch (HabaneroApplicationException ex)
            {
                StringAssert.Contains("A BOTestFactory is being Registered for '", ex.Message);
                StringAssert.Contains("but the BOTestFactory is Null", ex.Message);
            }
        }
 public void Test_Register_WhenNotFactoryType_ShouldThrowError()
 {
     //---------------Set up test pack-------------------
     BOTestFactoryRegistry registry = new BOTestFactoryRegistry();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     try
     {
         registry.Register<FakeBO>(typeof(RelatedFakeBo));
         Assert.Fail("Expected to throw an HabaneroApplicationException");
     }
     catch (HabaneroApplicationException ex)
     {
         StringAssert.Contains("A BOTestFactory is being Registered for '", ex.Message);
         StringAssert.Contains("is not of Type BOTestFactory", ex.Message);
     }
 }
 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);
 }
 public void Test_RegisterTwice_ShouldStoreSecond()
 {
     //---------------Set up test pack-------------------
     BOTestFactoryRegistry registry = new BOTestFactoryRegistry();
     registry.Register<FakeBO, BOTestFactoryFakeBO>();
     //---------------Assert Precondition----------------
     Assert.IsNotNull(registry.Resolve<FakeBO>());
     //---------------Execute Test ----------------------
     registry.Register<FakeBO, BOTestFactory<FakeBO>>();
     Assert.IsNotInstanceOf<BOTestFactoryFakeBO>(registry.Resolve<FakeBO>());
 }
 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);
 }
 public void Test_RegisterCustomBOTestFactory_ShouldReturnWhenResolved()
 {
     //---------------Set up test pack-------------------
     BOTestFactoryRegistry registry = new BOTestFactoryRegistry();
     //---------------Assert Precondition----------------
     registry.Register<FakeBO, BOTestFactoryFakeBO>();
     //---------------Execute Test ----------------------
     Assert.IsInstanceOf<BOTestFactoryFakeBO>(registry.Resolve<FakeBO>());
 }