Example #1
0
        public void WithTapAction_should_return_CardActionAssertions()
        {
            var tap          = new CardAction();
            var receiptItems = ReceiptItemTestData.CreateReceiptItemSetWithOneItemThatHasSetProperties(tap: tap);

            var sut = new ReceiptItemSetAssertions(receiptItems);

            sut.WithTapAction().Should().BeAssignableTo <CardActionSetAssertions>().And.NotBeNull();
        }
Example #2
0
        public void WithCardImage_should_return_CardImageAssertions()
        {
            var cardImage    = new CardImage();
            var receiptItems = ReceiptItemTestData.CreateReceiptItemSetWithOneItemThatHasSetProperties(image: cardImage);

            var sut = new ReceiptItemSetAssertions(receiptItems);

            sut.WithCardImage().Should().BeAssignableTo <CardImageSetAssertions>().And.NotBeNull();
        }
Example #3
0
        public void TextMatching_should_pass_when_using_standard_regex_features(string itemText, string regex)
        {
            var items = ReceiptItemTestData.CreateReceiptItemSetWithOneItemThatHasSetProperties(text: itemText);

            var sut = new ReceiptItemSetAssertions(items);

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

            act.ShouldNotThrow <Exception>();
        }
Example #4
0
        public void TextMatching_should_pass_if_regex_exactly_matches_Text_of_at_least_1_item_regardless_of_case(string itemText, string regex)
        {
            var items = ReceiptItemTestData.CreateReceiptItemSetWithOneItemThatHasSetProperties(text: itemText);

            var sut = new ReceiptItemSetAssertions(items);

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

            act.ShouldNotThrow <Exception>();
        }
Example #5
0
        public void TextMatching_should_pass_if_regex_exactly_matches_message_Text_of_one_item(string itemTextAndRegex)
        {
            var items = ReceiptItemTestData.CreateReceiptItemSetWithOneItemThatHasSetProperties(text: itemTextAndRegex);

            var sut = new ReceiptItemSetAssertions(items);

            Action act = () => sut.TextMatching(itemTextAndRegex);

            act.ShouldNotThrow <Exception>();
        }
Example #6
0
        public void TextMatching_should_output_matches_when_groupMatchingRegex_matches_Text_of_any_item()
        {
            IList <string> matches;

            const string someText = "some text";
            var          items    = ReceiptItemTestData.CreateReceiptItemSetWithOneItemThatHasSetProperties(text: someText);

            var sut = new ReceiptItemSetAssertions(items);

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

            matches.First().Should().Be(someText);
        }
Example #7
0
        public void TextMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_Text_several_times_for_a_single_item()
        {
            IList <string> matches;

            const string someText = "some text";
            var          items    = ReceiptItemTestData.CreateReceiptItemSetWithOneItemThatHasSetProperties(text: someText);

            var sut = new ReceiptItemSetAssertions(items);

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

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

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