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(); }
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(); }
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(); }
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(); }
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>(); }
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>(); }
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>(); }
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>(); }
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>(); }
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>(); }
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(); }
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(); }
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); }
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); }
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"); }
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); }