Ejemplo n.º 1
0
        public void TotalMatching_should_throw_ReceiptCardAssertionFailedException_when_regex_matches_no_cards(string regex)
        {
            var cards = ReceiptCardTestData.CreateRandomReceiptCards();

            var sut = new ReceiptCardSetAssertions(cards);

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

            act.ShouldThrow <ReceiptCardAssertionFailedException>();
        }
Ejemplo n.º 2
0
        public void TotalMatching_should_throw_ArgumentNullException_if_regex_is_null()
        {
            var cards = ReceiptCardTestData.CreateRandomReceiptCards();

            var sut = new ReceiptCardSetAssertions(cards);

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

            act.ShouldThrow <ArgumentNullException>();
        }
Ejemplo n.º 3
0
        public void TotalMatching_should_throw_ArgumentNullException_if_groupMatchRegex_is_null()
        {
            IList <string> matches;

            var cards = ReceiptCardTestData.CreateRandomReceiptCards();

            var sut = new ReceiptCardSetAssertions(cards);

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

            act.ShouldThrow <ArgumentNullException>();
        }
Ejemplo n.º 4
0
        public void TotalMatching_should_not_output_matches_when_groupMatchingRegex_does_not_match_Total_of_any_card()
        {
            IList <string> matches;

            var cards = ReceiptCardTestData.CreateRandomReceiptCards();

            var sut = new ReceiptCardSetAssertions(cards);

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

            matches.Should().BeNull();
        }
Ejemplo n.º 5
0
        public void TotalMatching_should_not_output_matches_when_regex_does_not_match_Total_of_any_cards()
        {
            IList <string> matches = null;

            var cards = ReceiptCardTestData.CreateRandomReceiptCards();

            var sut = new ReceiptCardSetAssertions(cards);

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

            act.ShouldThrow <ReceiptCardAssertionFailedException>();
            matches.Should().BeNull();
        }
Ejemplo n.º 6
0
        public void Extracted_receipt_cards_are_used_to_create_receipt_card_set_assertions()
        {
            var receiptCards = ReceiptCardTestData.CreateRandomReceiptCards();

            _extractor.ExtractCards <ReceiptCard>(Arg.Any <IEnumerable <Activity> >()).Returns(receiptCards);

            var sut = new ActivitySetAttachmentAssertions(ActivityTestData.CreateRandomActivities());

            var result = sut.OfTypeReceiptCard();

            result.Should().BeAssignableTo <ReceiptCardSetAssertions>();
            var assertions = (ReceiptCardSetAssertions)result;

            assertions.ReceiptCards.ShouldBeEquivalentTo(receiptCards);
        }
Ejemplo n.º 7
0
        public void TotalMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_Total_on_multiple_cards()
        {
            IList <string> matches;

            var cards = ReceiptCardTestData.CreateRandomReceiptCards();

            cards.Add(new ReceiptCard(total: "some text"));
            cards.Add(new ReceiptCard(total: "same text"));

            var sut = new ReceiptCardSetAssertions(cards);

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

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