Ejemplo n.º 1
0
        public void WithReceiptItem_should_return_ReceiptItemSetAssertions()
        {
            var receiptItems = ReceiptItemTestData.CreateRandomReceiptItems();
            var cards        = ReceiptCardTestData.CreateReceiptCardSetWithOneCardThatHasSetProperties(items: receiptItems);

            var sut = new ReceiptCardSetAssertions(cards);

            sut.WithReceiptItem().Should().BeAssignableTo <ReceiptItemSetAssertions>().And.NotBeNull();
        }
Ejemplo n.º 2
0
        public void WithTapAction_should_return_CardActionSetAssertions()
        {
            var tap   = new CardAction();
            var cards = ReceiptCardTestData.CreateReceiptCardSetWithOneCardThatHasSetProperties(tap: tap);

            var sut = new ReceiptCardSetAssertions(cards);

            sut.WithTapAction().Should().BeAssignableTo <CardActionSetAssertions>().And.NotBeNull();
        }
Ejemplo n.º 3
0
        public void WithButtons_should_return_CardActionSetAssertions()
        {
            var buttons = CardActionTestData.CreateRandomCardActions();
            var cards   = ReceiptCardTestData.CreateReceiptCardSetWithOneCardThatHasSetProperties(buttons: buttons);

            var sut = new ReceiptCardSetAssertions(cards);

            sut.WithButtons().Should().BeAssignableTo <CardActionSetAssertions>().And.NotBeNull();
        }
Ejemplo n.º 4
0
        public void TotalMatching_should_pass_when_using_standard_regex_features(string cardTotal, string regex)
        {
            var cards = ReceiptCardTestData.CreateReceiptCardSetWithOneCardThatHasSetProperties(total: cardTotal);

            var sut = new ReceiptCardSetAssertions(cards);

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

            act.ShouldNotThrow <Exception>();
        }
Ejemplo n.º 5
0
        public void TotalMatching_should_pass_if_regex_exactly_matches_Total_of_at_least_1_card_regardless_of_case(string cardTotal, string regex)
        {
            var cards = ReceiptCardTestData.CreateReceiptCardSetWithOneCardThatHasSetProperties(total: cardTotal);

            var sut = new ReceiptCardSetAssertions(cards);

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

            act.ShouldNotThrow <Exception>();
        }
Ejemplo n.º 6
0
        public void TotalMatching_should_pass_if_regex_exactly_matches_message_Total_of_one_card(string cardTotalAndRegex)
        {
            var cards = ReceiptCardTestData.CreateReceiptCardSetWithOneCardThatHasSetProperties(total: cardTotalAndRegex);

            var sut = new ReceiptCardSetAssertions(cards);

            Action act = () => sut.TotalMatching(cardTotalAndRegex);

            act.ShouldNotThrow <Exception>();
        }
Ejemplo n.º 7
0
        public void TotalMatching_should_output_matches_when_groupMatchingRegex_matches_Total_of_any_card()
        {
            IList <string> matches;

            const string someTotal = "some text";
            var          cards     = ReceiptCardTestData.CreateReceiptCardSetWithOneCardThatHasSetProperties(total: someTotal);

            var sut = new ReceiptCardSetAssertions(cards);

            sut.TotalMatching(someTotal, $"({someTotal})", out matches);

            matches.First().Should().Be(someTotal);
        }
Ejemplo n.º 8
0
        public void TotalMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_Total_several_times_for_a_single_card()
        {
            IList <string> matches;

            const string someTotal = "some text";
            var          cards     = ReceiptCardTestData.CreateReceiptCardSetWithOneCardThatHasSetProperties(total: someTotal);

            var sut = new ReceiptCardSetAssertions(cards);

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

            sut.TotalMatching(someTotal, $"({match1}) ({match2})", out matches);

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