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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }