Пример #1
0
        public void WithFact_should_return_FactSetAssertions()
        {
            var facts       = FactTestData.CreateRandomFacts();
            var receiptCard = new ReceiptCard(facts: facts);

            var sut = new ReceiptCardAssertions(receiptCard);

            sut.WithFact().Should().BeAssignableTo <FactSetAssertions>().And.NotBeNull();
        }
Пример #2
0
        public void WithButtons_should_return_CardActionSetAssertions()
        {
            var buttons     = CardActionTestData.CreateRandomCardActions();
            var receiptCard = new ReceiptCard(buttons: buttons);

            var sut = new ReceiptCardAssertions(receiptCard);

            sut.WithButtons().Should().BeAssignableTo <CardActionSetAssertions>().And.NotBeNull();
        }
Пример #3
0
        public void WithTapAction_should_return_CardActionAssertions()
        {
            var tap         = new CardAction();
            var receiptCard = new ReceiptCard(tap: tap);

            var sut = new ReceiptCardAssertions(receiptCard);

            sut.WithTapAction().Should().BeAssignableTo <CardActionAssertions>().And.NotBeNull();
        }
Пример #4
0
        public void WithReceiptItem_should_return_ReceiptItemSetAssertions()
        {
            var receiptItems = ReceiptItemTestData.CreateRandomReceiptItems();
            var receiptCard  = new ReceiptCard(items: receiptItems);

            var sut = new ReceiptCardAssertions(receiptCard);

            sut.WithReceiptItem().Should().BeAssignableTo <ReceiptItemSetAssertions>().And.NotBeNull();
        }
Пример #5
0
        public void TaxMatching_should_pass_regardless_of_case(string cardTax, string regex)
        {
            var receiptCard = new ReceiptCard(tax: cardTax);

            var sut = new ReceiptCardAssertions(receiptCard);

            Action act = () => sut.TaxMatching(regex);

            act.ShouldNotThrow <Exception>();
        }
Пример #6
0
        public void TaxMatching_should_pass_if_regex_exactly_matches_message_Tax(string cardTaxAndRegex)
        {
            var receiptCard = new ReceiptCard(tax: cardTaxAndRegex);

            var sut = new ReceiptCardAssertions(receiptCard);

            Action act = () => sut.TaxMatching(cardTaxAndRegex);

            act.ShouldNotThrow <Exception>();
        }
Пример #7
0
        public void TaxMatching_should_throw_ArgumentNullException_if_regex_is_null()
        {
            var card = new ReceiptCard();

            var sut = new ReceiptCardAssertions(card);

            Action act = () => sut.TaxMatching(null);

            act.ShouldThrow <ArgumentNullException>();
        }
Пример #8
0
        public void TaxMatching_should_throw_ReceiptCardAssertionFailedException_when_text_is_null()
        {
            var card = new ReceiptCard();

            var sut = new ReceiptCardAssertions(card);

            Action act = () => sut.TaxMatching("anything");

            act.ShouldThrow <ReceiptCardAssertionFailedException>();
        }
Пример #9
0
        public void TaxMatching_should_throw_ReceiptCardAssertionFailedException_for_non_matching_regexes(string cardTax, string regex)
        {
            var receiptCard = new ReceiptCard(tax: cardTax);

            var sut = new ReceiptCardAssertions(receiptCard);

            Action act = () => sut.TaxMatching(regex);

            act.ShouldThrow <ReceiptCardAssertionFailedException>();
        }
Пример #10
0
        public void TaxMatching_should_pass_when_using_standard_regex_features(string cardTax, string regex)
        {
            var receiptCard = new ReceiptCard(tax: cardTax);

            var sut = new ReceiptCardAssertions(receiptCard);

            Action act = () => sut.TaxMatching(regex);

            act.ShouldNotThrow <Exception>();
        }
Пример #11
0
        public void TaxMatching_should_throw_ReceiptCardAssertionFailedException_when_trying_to_capture_groups_but_text_is_null()
        {
            IList <string> matches;
            var            card = new ReceiptCard();

            var sut = new ReceiptCardAssertions(card);

            Action act = () => sut.TaxMatching("anything", "(.*)", out matches);

            act.ShouldThrow <ReceiptCardAssertionFailedException>();
        }
Пример #12
0
        public void TitleMatching_should_throw_ArgumentNullException_if_when_capturing_groups_regex_is_null()
        {
            IList <string> matches;

            var card = new ReceiptCard();

            var sut = new ReceiptCardAssertions(card);

            Action act = () => sut.TitleMatching(null, "(.*)", out matches);

            act.ShouldThrow <ArgumentNullException>();
        }
Пример #13
0
        public void TaxMatching_should_throw_ArgumentNullException_if_groupMatchRegex_is_null()
        {
            IList <string> matches;

            var card = new ReceiptCard();

            var sut = new ReceiptCardAssertions(card);

            Action act = () => sut.TaxMatching("(.*)", null, out matches);

            act.ShouldThrow <ArgumentNullException>();
        }
Пример #14
0
        public void TaxMatching_should_not_output_matches_when_groupMatchingRegex_does_not_match_text()
        {
            IList <string> matches;

            var receiptCard = new ReceiptCard(tax: "some text");

            var sut = new ReceiptCardAssertions(receiptCard);

            sut.TaxMatching("some text", "(non matching)", out matches);

            matches.Should().BeNull();
        }
Пример #15
0
        public void TaxMatching_should_output_matches_when_groupMatchingRegex_matches_text()
        {
            IList <string> matches;

            const string someText    = "some text";
            var          receiptCard = new ReceiptCard(tax: someText);

            var sut = new ReceiptCardAssertions(receiptCard);

            sut.TaxMatching(someText, $"({someText})", out matches);

            matches.First().Should().Be(someText);
        }
Пример #16
0
        public void TaxMatching_should_not_output_matches_when_regex_does_not_match_text()
        {
            IList <string> matches = null;

            var receiptCard = new ReceiptCard(tax: "some text");

            var sut = new ReceiptCardAssertions(receiptCard);

            Action act = () => sut.TaxMatching("non matching regex", "(some text)", out matches);

            act.ShouldThrow <ReceiptCardAssertionFailedException>();
            matches.Should().BeNull();
        }
Пример #17
0
        public void TaxMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_text_several_times()
        {
            IList <string> matches;

            const string someText    = "some text";
            var          receiptCard = new ReceiptCard(tax: someText);

            var sut = new ReceiptCardAssertions(receiptCard);

            const string match1 = "some";
            const string match2 = "text";

            sut.TaxMatching(someText, $"({match1}) ({match2})", out matches);

            matches.Should().Contain(match1, match2);
        }