public void InvalidCandidate_ReturnFalse(string candidate)
            {
                var sut = new CreditCardSpecification();

                var result = sut.IsSatisfiedBy(candidate);

                Assert.False(result);
            }
            public void ValidCandidate_ReturnTrue(string candidate)
            {
                var sut = new CreditCardSpecification();

                var result = sut.IsNotSatisfiedBy(candidate);

                Assert.True(result);
            }
Exemple #3
0
            public void InvokeInvalidCandidate_ReturnFalse(string candidate)
            {
                var sut = new CreditCardSpecification();

                var result = sut.GetNegationExpression().Compile().Invoke(candidate);

                Assert.False(result);
            }
Exemple #4
0
        public void InvokeCreditCard_ReturnCreditCardSpecification()
        {
            var expected = new CreditCardSpecification();

            var sut = Specification.CreditCard();

            Assert.Equal(expected, sut, new SpecificationComparer());
        }
Exemple #5
0
        public void InvokeCompositeCreditCard_ReturnCreditCardSpecification()
        {
            var expected = new CreditCardSpecification();

            var sut = new MockCompositeSpecification<string>().CreditCard();

            Assert.Equal(expected, sut, new SpecificationComparer());
        }
            public void InvalidCandidate_ReturnExpectedResultObject(string candidate, SpecificationResult expected)
            {
                var sut = new CreditCardSpecification();

                var overall = sut.IsSatisfiedBy(candidate, out var result);

                Assert.False(overall);
                Assert.Equal(expected, result, new SpecificationResultComparer(candidate));
            }
Exemple #7
0
            public void NonGenericILinqSpecification_ReturnExpressionAsAbstractExpression()
            {
                var sut = new CreditCardSpecification();

                var expected      = sut.GetExpression().ToString();
                var sutExpression = ((ILinqSpecification)sut).GetExpression();
                var result        = sutExpression.ToString();

                Assert.Equal(expected, result);
            }
 public PlaceOrderPage(IWebDriver driver, PurchaseTestInput purchaseTestInput) : base(driver)
 {
     _purchaseTestInput = purchaseTestInput;
     _promotionalPurchaseSpecification = new PromotionalPurchaseSpecification(purchaseTestInput);
     _wiretransferSpecification        = new WiretransferSpecification(purchaseTestInput);
     _creditCardSpecification          = new CreditCardSpecification(purchaseTestInput);
     _freePurchaseSpecification        = new FreePurchaseSpecification();
     IsPromoCodePurchase  = _freePurchaseSpecification.Or(_promotionalPurchaseSpecification).IsSatisfiedBy(_purchaseTestInput);
     IsCreditCardPurchase = _creditCardSpecification.
                            And(_wiretransferSpecification.Not()).
                            And(_freePurchaseSpecification.Not()).
                            And(_promotionalPurchaseSpecification.Not()).
                            IsSatisfiedBy(_purchaseTestInput);
 }
 public PlaceOrderPage(IWebDriver driver, PurchaseTestInput purchaseTestInput) : base(driver)
 {
     this.purchaseTestInput = purchaseTestInput;
     this.promotionalPurchaseSpecification = new PromotionalPurchaseSpecification(purchaseTestInput);
     this.wiretransferSpecification = new WiretransferSpecification(purchaseTestInput);
     this.creditCardSpecification = new CreditCardSpecification(purchaseTestInput);
     this.freePurchaseSpecification = new FreePurchaseSpecification();
     this.IsPromoCodePurchase = this.freePurchaseSpecification.Or(this.promotionalPurchaseSpecification).IsSatisfiedBy(this.purchaseTestInput);
     this.IsCreditCardPurchase = this.creditCardSpecification.
     And(this.wiretransferSpecification.Not()).
     And(this.freePurchaseSpecification.Not()).
     And(this.promotionalPurchaseSpecification.Not()).
     IsSatisfiedBy(this.purchaseTestInput);
 }
Exemple #10
0
 public PlaceOrderPage(IWebDriver driver, PurchaseTestInput purchaseTestInput) : base(driver)
 {
     this.purchaseTestInput = purchaseTestInput;
     this.promotionalPurchaseSpecification = new PromotionalPurchaseSpecification(purchaseTestInput);
     this.wiretransferSpecification        = new WiretransferSpecification(purchaseTestInput);
     this.creditCardSpecification          = new CreditCardSpecification(purchaseTestInput);
     this.freePurchaseSpecification        = new FreePurchaseSpecification();
     this.IsPromoCodePurchase  = this.freePurchaseSpecification.Or(this.promotionalPurchaseSpecification).IsSatisfiedBy(this.purchaseTestInput);
     this.IsCreditCardPurchase = this.creditCardSpecification.
                                 And(this.wiretransferSpecification.Not()).
                                 And(this.freePurchaseSpecification.Not()).
                                 And(this.promotionalPurchaseSpecification.Not()).
                                 IsSatisfiedBy(this.purchaseTestInput);
 }