Example #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();
        }
Example #2
0
        public void WithFact_should_return_FactSetAssertions()
        {
            var facts = FactTestData.CreateRandomFacts();
            var cards = ReceiptCardTestData.CreateReceiptCardSetWithAllCardsWithSetProperties(facts: facts);

            var sut = new ReceiptCardSetAssertions(cards);

            sut.WithFact().Should().BeAssignableTo <FactSetAssertions>().And.NotBeNull();
        }
Example #3
0
        public void KeyMatching_should_throw_FactAssertionFailedException_when_regex_matches_no_cards(string regex)
        {
            var facts = FactTestData.CreateRandomFacts();

            var sut = new FactSetAssertions(facts);

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

            act.ShouldThrow <FactAssertionFailedException>();
        }
Example #4
0
        public void KeyMatching_should_throw_ArgumentNullException_if_regex_is_null()
        {
            var facts = FactTestData.CreateRandomFacts();

            var sut = new FactSetAssertions(facts);

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

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

            var facts = FactTestData.CreateRandomFacts();

            var sut = new FactSetAssertions(facts);

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

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

            var facts = FactTestData.CreateRandomFacts();

            var sut = new FactSetAssertions(facts);

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

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

            var facts = FactTestData.CreateRandomFacts();

            var sut = new FactSetAssertions(facts);

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

            act.ShouldThrow <ArgumentNullException>();
        }
Example #8
0
        public void KeyMatching_should_not_output_matches_when_regex_does_not_match_Key_of_any_cards()
        {
            IList <string> matches = null;

            var facts = FactTestData.CreateRandomFacts();

            var sut = new FactSetAssertions(facts);

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

            act.ShouldThrow <FactAssertionFailedException>();
            matches.Should().BeNull();
        }
        public void Only_non_null_facts_from_list_of_Facts_should_be_available()
        {
            var nonNullFacts = FactTestData.CreateRandomFacts();
            var facts        = new List <Fact> {
                null
            };

            facts.AddRange(nonNullFacts);

            var assertions = new FactSetAssertions(facts);

            assertions.Facts.ShouldBeEquivalentTo(nonNullFacts);
        }
Example #10
0
        public void KeyMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_Key_on_multiple_cards()
        {
            IList <string> matches;

            var facts = FactTestData.CreateRandomFacts();

            facts.Add(new Fact(key: "some text"));
            facts.Add(new Fact(key: "same text"));

            var sut = new FactSetAssertions(facts);

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

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