public void CanPurchase_PersonWitNoCreditPassesValidation_ReturnFalse()
        {
            MyLittleFakeValidator validator = new MyLittleFakeValidator();

            validator.WillReturnIsValid = true;

            PersonLogicBTestable pl = new PersonLogicBTestable(validator);

            bool canPurchase = pl.CanPurchase(new Person());

            Assert.IsFalse(canPurchase);
        }
Exemple #2
0
        public void CanPurchase_AllIsWell_ReturnsTrue()
        {
            FakeTestingValidator fakeValidator
                        = makeFakeValidator(true);

            PersonLogicBTestable logicUnderTest = new PersonLogicBTestable(fakeValidator);
            //Person to pass in
            Person p = makePersonWithPurchasePossible();

            //test
            bool canPurchase = logicUnderTest.CanPurchase(p);
            Assert.IsTrue(canPurchase);
        }
        public void CanPurchase_AllIsWell_ReturnsTrue()
        {
            FakeTestingValidator fakeValidator
                = makeFakeValidator(true);

            PersonLogicBTestable logicUnderTest = new PersonLogicBTestable(fakeValidator);
            //Person to pass in
            Person p = makePersonWithPurchasePossible();

            //test
            bool canPurchase = logicUnderTest.CanPurchase(p);

            Assert.IsTrue(canPurchase);
        }
Exemple #4
0
        public void IOC_Unity()
        {
            IUnityContainer unityContainer = new UnityContainer();

            unityContainer
            .RegisterType <ILogger, FakeLogger>()
            .RegisterType <IPersonValidator, FakeTestingValidator>();

            PersonLogicBTestable logic =
                unityContainer.Resolve <PersonLogicBTestable>();

            bool canPurchase = logic.CanPurchase(new Person());

            Assert.IsFalse(canPurchase);
        }
Exemple #5
0
        public void IOC_Castle()
        {
            IWindsorContainer container = new WindsorContainer();

            container.AddComponent <PersonLogicBTestable>();
            container.AddComponent <ILogger, FakeLogger>();
            container.AddComponent <IPersonValidator, MyFakeValidator>();

            PersonLogicBTestable logic =
                container.Resolve <PersonLogicBTestable>();

            bool canPurchase = logic.CanPurchase(new Person());

            Assert.IsFalse(canPurchase);
        }
        public void CanPurchase_IsNotValid_ReturnsFalse()
        {
            FakeTestingValidator fakeValidator
                = makeFakeValidator(false);

            PersonLogicBTestable logicUnderTest =
                makeLogicWithValidator(fakeValidator);

            //Person to pass in
            Person p = makePersonWithPurchasePossible();


            //test
            bool canPurchase = logicUnderTest.CanPurchase(p);

            Assert.IsFalse(canPurchase);
        }
        public void CanPurchase_NullSubcriptionType_ReturnsFalse()
        {
            FakeTestingValidator fakeValidator
                = makeFakeValidator(true);

            PersonLogicBTestable logicUnderTest =
                makeLogicWithValidator(fakeValidator);

            Person p = makePersonWithPurchasePossible();

            p.SubscriptionType = null;

            //test
            bool canPurchase = logicUnderTest.CanPurchase(p);

            Assert.IsFalse(canPurchase);
        }
        public void CanPurchase_CreditLessThan1_ReturnsFalse()
        {
            FakeTestingValidator fakeValidator
                = makeFakeValidator(true);

            PersonLogicBTestable logic =
                makeLogicWithValidator(fakeValidator);

            Person p = makePersonWithPurchasePossible();

            p.CreditOnFile = 0;

            //test
            bool canPurchase = logic.CanPurchase(p);

            Assert.IsFalse(canPurchase);
        }
Exemple #9
0
        public void CanPurchase_PersonWitNoCreditPassesValidation_ReturnFalse()
        {
            MyLittleFakeValidator validator = new MyLittleFakeValidator();
            validator.WillReturnIsValid = true;

            PersonLogicBTestable pl = new PersonLogicBTestable(validator);

            bool canPurchase = pl.CanPurchase(new Person());
            Assert.IsFalse(canPurchase);
        }
Exemple #10
0
 private PersonLogicBTestable makeLogicWithValidator(FakeTestingValidator fakeValidator)
 {
     PersonLogicBTestable logicUnderTest = new PersonLogicBTestable(fakeValidator);
     return logicUnderTest;
 }
        private PersonLogicBTestable makeLogicWithValidator(FakeTestingValidator fakeValidator)
        {
            PersonLogicBTestable logicUnderTest = new PersonLogicBTestable(fakeValidator);

            return(logicUnderTest);
        }