public void TypeMatching_should_throw_CardActionAssertionFailedException_when_type_of_card_action_is_null() { var cardAction = new CardAction(type: null); var sut = new CardActionAssertions(cardAction); Action act = () => sut.ActionType(CardActionType.Call); act.ShouldThrow <CardActionAssertionFailedException>(); }
public void ValueMatching_should_throw_CardActionAssertionFailedException_for_non_matching_regexes(string value, string regex) { var cardAction = new CardAction(value: value); var sut = new CardActionAssertions(cardAction); Action act = () => sut.ValueMatching(regex); act.ShouldThrow <CardActionAssertionFailedException>(); }
public void ImageMatching_should_pass_if_regex_exactly_matches_image_image(string imageAndRegex) { var cardAction = new CardAction(image: imageAndRegex); var sut = new CardActionAssertions(cardAction); Action act = () => sut.ImageMatching(imageAndRegex); act.ShouldNotThrow <Exception>(); }
public void ValueMatching_should_pass_when_using_standard_regex_features(string value, string regex) { var cardAction = new CardAction(value: value); var sut = new CardActionAssertions(cardAction); Action act = () => sut.ValueMatching(regex); act.ShouldNotThrow <Exception>(); }
public void ValueMatching_should_pass_if_regex_exactly_matches_image_value(string valueAndRegex) { var cardAction = new CardAction(value: valueAndRegex); var sut = new CardActionAssertions(cardAction); Action act = () => sut.ValueMatching(valueAndRegex); act.ShouldNotThrow <Exception>(); }
public void ValueMatching_should_pass_regardless_of_case(string value, string regex) { var cardAction = new CardAction(value: value); var sut = new CardActionAssertions(cardAction); Action act = () => sut.ValueMatching(regex); act.ShouldNotThrow <Exception>(); }
public void ValueMatching_should_throw_CardActionAssertionFailedException_when_text_is_null() { var cardAction = new CardAction(); var sut = new CardActionAssertions(cardAction); Action act = () => sut.ValueMatching("anything"); act.ShouldThrow <CardActionAssertionFailedException>(); }
public void ValueMatching_should_throw_ArgumentNullException_when_regex_is_null() { var cardAction = new CardAction(value: "some text"); var sut = new CardActionAssertions(cardAction); Action act = () => sut.ValueMatching(null); act.ShouldThrow <ArgumentNullException>(); }
public void TitleMatching_should_pass_if_regex_exactly_matches_image_title(string titleAndRegex) { var cardAction = new CardAction(title: titleAndRegex); var sut = new CardActionAssertions(cardAction); Action act = () => sut.TitleMatching(titleAndRegex); act.ShouldNotThrow <Exception>(); }
public void ValueMatching_should_throw_ArgumentNullException_when_regex_is_null_when_trying_to_match_groups() { var cardAction = new CardAction(value: "some text"); var sut = new CardActionAssertions(cardAction); IList <string> matches; Action act = () => sut.ValueMatching(null, "(.*)", out matches); act.ShouldThrow <ArgumentNullException>(); }
public void ValueMatching_should_throw_CardActionAssertionFailedException_when_trying_to_capture_groups_but_text_is_null() { IList <string> matches; var cardAction = new CardAction(); var sut = new CardActionAssertions(cardAction); Action act = () => sut.ValueMatching("anything", "(.*)", out matches); act.ShouldThrow <CardActionAssertionFailedException>(); }
public void TypeMatching_should_throw_CardActionAssertionFailedException_for_non_matching_types() { var type = CardActionTypeMap.Map(CardActionType.Call); var cardAction = new CardAction(type: type); var sut = new CardActionAssertions(cardAction); Action act = () => sut.ActionType(CardActionType.DownloadFile); act.ShouldThrow <CardActionAssertionFailedException>(); }
public void ValueMatching_should_throw_ArgumentNullException_when_groupMatchRegex_is_null() { IList <string> matches; var cardAction = new CardAction(value: "some text"); var sut = new CardActionAssertions(cardAction); Action act = () => sut.ValueMatching(".*", null, out matches); act.ShouldThrow <ArgumentNullException>(); }
public void ValueMatching_should_not_output_matches_when_groupMatchingRegex_does_not_match_text() { IList <string> matches; var cardAction = new CardAction(value: "some text"); var sut = new CardActionAssertions(cardAction); sut.ValueMatching("some text", "(non matching)", out matches); matches.Should().BeNull(); }
public void TypeMatching_should_not_throw_when_card_action_type_matches_expected_type() { const CardActionType call = CardActionType.Call; var type = CardActionTypeMap.Map(call); var cardAction = new CardAction(type: type); var sut = new CardActionAssertions(cardAction); Action act = () => sut.ActionType(call); act.ShouldNotThrow <Exception>(); }
public void ValueMatching_should_output_matches_when_groupMatchingRegex_matches_text() { IList <string> matches; const string someText = "some text"; var cardAction = new CardAction(value: someText); var sut = new CardActionAssertions(cardAction); sut.ValueMatching(someText, $"({someText})", out matches); matches.First().Should().Be(someText); }
public void ValueMatching_should_not_output_matches_when_regex_does_not_match_text() { IList <string> matches = null; var cardAction = new CardAction(value: "some text"); var sut = new CardActionAssertions(cardAction); Action act = () => sut.ValueMatching("non matching regex", "(some text)", out matches); act.ShouldThrow <CardActionAssertionFailedException>(); matches.Should().BeNull(); }
public void ValueMatching_should_output_multiple_matches_when_groupMatchingRegex_matches_text_several_times() { IList <string> matches; const string someText = "some text"; var cardAction = new CardAction(value: someText); var sut = new CardActionAssertions(cardAction); var match1 = "some"; var match2 = "text"; sut.ValueMatching(someText, $"({match1}) ({match2})", out matches); matches.Should().Contain(match1, match2); }