Example #1
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();
        }
Example #2
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();
        }
Example #3
0
        public void TextMatching_should_throw_ReceiptItemAssertionFailedException_when_regex_matches_no_items(string regex)
        {
            var items = ReceiptItemTestData.CreateRandomReceiptItems();

            var sut = new ReceiptItemSetAssertions(items);

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

            act.ShouldThrow <ReceiptItemAssertionFailedException>();
        }
Example #4
0
        public void TextMatching_should_throw_ArgumentNullException_if_regex_is_null()
        {
            var items = ReceiptItemTestData.CreateRandomReceiptItems();

            var sut = new ReceiptItemSetAssertions(items);

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

            act.ShouldThrow <ArgumentNullException>();
        }
Example #5
0
        public void TextMatching_should_throw_ArgumentNullException_if_groupMatchRegex_is_null()
        {
            IList <string> matches;

            var items = ReceiptItemTestData.CreateRandomReceiptItems();

            var sut = new ReceiptItemSetAssertions(items);

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

            act.ShouldThrow <ArgumentNullException>();
        }
Example #6
0
        public void TextMatching_should_not_output_matches_when_groupMatchingRegex_does_not_match_Text_of_any_item()
        {
            IList <string> matches;

            var items = ReceiptItemTestData.CreateRandomReceiptItems();

            var sut = new ReceiptItemSetAssertions(items);

            sut.TextMatching(".*", "(non matching)", out matches);

            matches.Should().BeNull();
        }
Example #7
0
        public void SubtitleMatching_should_throw_ArgumentNullException_if_when_capturing_groups_regex_is_null()
        {
            IList <string> matches;

            var items = ReceiptItemTestData.CreateRandomReceiptItems();

            var sut = new ReceiptItemSetAssertions(items);

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

            act.ShouldThrow <ArgumentNullException>();
        }
Example #8
0
        public void Only_non_null_ReceiptItems_from_ReceiptItem_list_should_be_available_for_assertion()
        {
            var nonNullReceiptItems = ReceiptItemTestData.CreateRandomReceiptItems();
            var receiptItems        = new List <ReceiptItem> {
                null
            };

            receiptItems.AddRange(nonNullReceiptItems);

            var sut = new ReceiptItemSetAssertions(receiptItems);

            sut.ReceiptItems.ShouldBeEquivalentTo(nonNullReceiptItems);
        }
Example #9
0
        public void TextMatching_should_not_output_matches_when_regex_does_not_match_Text_of_any_items()
        {
            IList <string> matches = null;

            var items = ReceiptItemTestData.CreateRandomReceiptItems();

            var sut = new ReceiptItemSetAssertions(items);

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

            act.ShouldThrow <ReceiptItemAssertionFailedException>();
            matches.Should().BeNull();
        }
Example #10
0
        public void TextMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_Text_on_multiple_items()
        {
            IList <string> matches;

            var items = ReceiptItemTestData.CreateRandomReceiptItems();

            items.Add(new ReceiptItem(text: "some text"));
            items.Add(new ReceiptItem(text: "same text"));

            var sut = new ReceiptItemSetAssertions(items);

            sut.TextMatching(".*", @"(s[oa]me) (text)", out matches);

            matches.Should().Contain("some", "same", "text");
        }