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(); }
public void WithButtons_should_return_CardActionSetAssertions() { var buttons = CardActionTestData.CreateRandomCardActions(); var receiptCard = new ReceiptCard(buttons: buttons); var sut = new ReceiptCardAssertions(receiptCard); sut.WithButtons().Should().BeAssignableTo <CardActionSetAssertions>().And.NotBeNull(); }
public void WithTapAction_should_return_CardActionAssertions() { var tap = new CardAction(); var receiptCard = new ReceiptCard(tap: tap); var sut = new ReceiptCardAssertions(receiptCard); sut.WithTapAction().Should().BeAssignableTo <CardActionAssertions>().And.NotBeNull(); }
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(); }
public void TaxMatching_should_pass_regardless_of_case(string cardTax, string regex) { var receiptCard = new ReceiptCard(tax: cardTax); var sut = new ReceiptCardAssertions(receiptCard); Action act = () => sut.TaxMatching(regex); act.ShouldNotThrow <Exception>(); }
public void TaxMatching_should_pass_if_regex_exactly_matches_message_Tax(string cardTaxAndRegex) { var receiptCard = new ReceiptCard(tax: cardTaxAndRegex); var sut = new ReceiptCardAssertions(receiptCard); Action act = () => sut.TaxMatching(cardTaxAndRegex); act.ShouldNotThrow <Exception>(); }
public void TaxMatching_should_throw_ArgumentNullException_if_regex_is_null() { var card = new ReceiptCard(); var sut = new ReceiptCardAssertions(card); Action act = () => sut.TaxMatching(null); act.ShouldThrow <ArgumentNullException>(); }
public void TaxMatching_should_throw_ReceiptCardAssertionFailedException_when_text_is_null() { var card = new ReceiptCard(); var sut = new ReceiptCardAssertions(card); Action act = () => sut.TaxMatching("anything"); act.ShouldThrow <ReceiptCardAssertionFailedException>(); }
public void TaxMatching_should_throw_ReceiptCardAssertionFailedException_for_non_matching_regexes(string cardTax, string regex) { var receiptCard = new ReceiptCard(tax: cardTax); var sut = new ReceiptCardAssertions(receiptCard); Action act = () => sut.TaxMatching(regex); act.ShouldThrow <ReceiptCardAssertionFailedException>(); }
public void TaxMatching_should_pass_when_using_standard_regex_features(string cardTax, string regex) { var receiptCard = new ReceiptCard(tax: cardTax); var sut = new ReceiptCardAssertions(receiptCard); Action act = () => sut.TaxMatching(regex); act.ShouldNotThrow <Exception>(); }
public void TaxMatching_should_throw_ReceiptCardAssertionFailedException_when_trying_to_capture_groups_but_text_is_null() { IList <string> matches; var card = new ReceiptCard(); var sut = new ReceiptCardAssertions(card); Action act = () => sut.TaxMatching("anything", "(.*)", out matches); act.ShouldThrow <ReceiptCardAssertionFailedException>(); }
public void TitleMatching_should_throw_ArgumentNullException_if_when_capturing_groups_regex_is_null() { IList <string> matches; var card = new ReceiptCard(); var sut = new ReceiptCardAssertions(card); Action act = () => sut.TitleMatching(null, "(.*)", out matches); act.ShouldThrow <ArgumentNullException>(); }
public void TaxMatching_should_throw_ArgumentNullException_if_groupMatchRegex_is_null() { IList <string> matches; var card = new ReceiptCard(); var sut = new ReceiptCardAssertions(card); Action act = () => sut.TaxMatching("(.*)", null, out matches); act.ShouldThrow <ArgumentNullException>(); }
public void TaxMatching_should_not_output_matches_when_groupMatchingRegex_does_not_match_text() { IList <string> matches; var receiptCard = new ReceiptCard(tax: "some text"); var sut = new ReceiptCardAssertions(receiptCard); sut.TaxMatching("some text", "(non matching)", out matches); matches.Should().BeNull(); }
public void TaxMatching_should_output_matches_when_groupMatchingRegex_matches_text() { IList <string> matches; const string someText = "some text"; var receiptCard = new ReceiptCard(tax: someText); var sut = new ReceiptCardAssertions(receiptCard); sut.TaxMatching(someText, $"({someText})", out matches); matches.First().Should().Be(someText); }
public void TaxMatching_should_not_output_matches_when_regex_does_not_match_text() { IList <string> matches = null; var receiptCard = new ReceiptCard(tax: "some text"); var sut = new ReceiptCardAssertions(receiptCard); Action act = () => sut.TaxMatching("non matching regex", "(some text)", out matches); act.ShouldThrow <ReceiptCardAssertionFailedException>(); matches.Should().BeNull(); }
public void TaxMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_text_several_times() { IList <string> matches; const string someText = "some text"; var receiptCard = new ReceiptCard(tax: someText); var sut = new ReceiptCardAssertions(receiptCard); const string match1 = "some"; const string match2 = "text"; sut.TaxMatching(someText, $"({match1}) ({match2})", out matches); matches.Should().Contain(match1, match2); }