public void ValidateStringNotMatchesRegex() { // Given var validator = new StringInverseValidator("string"); // When validator.MatchRegex("^.$"); // Then Assert.True(true); }
public void ValidateStringNotMatchesRegexPatternViolated() { // Given var validator = new StringInverseValidator("string"); // When var exception = Assert.Throws <XunitException>(() => validator.MatchRegex(".*", "that's the bottom line")); // Then Assert.NotNull(exception); var rn = Environment.NewLine; Assert.Equal( $"{rn}validator{rn}is \"string\"{rn}but was expected to not match regular expression \".*\"{rn}because that's the bottom line", exception.UserMessage); }