Exemple #1
0
    public void StringDoesNotMatchRegexPattern()
    {
        string pattern     = "...";
        string actualValue = "xxx";

        // MSTest does not support this case.

        // NUnit
        Assert.That(actualValue, Does.Not.Match(pattern), () => "Some context");
        // Some context
        //  Expected: not String matching "..."
        //  But was: "xxx"

        // XUnit
        XUnitAssert.DoesNotMatch(pattern, actualValue);
        // Assert.DoesNotMatch() Failure
        // Regex: ...
        // Value: xxx

        // Fluent
        actualValue.Should().NotMatchRegex(pattern, "SOME REASONS");
        // Did not expect actualValue to match regex "..." because SOME REASONS, but "xxx" matches.

        // Shouldly
        actualValue.ShouldNotMatch(pattern, "Some context");
        // actualValue
        //   should not match "..." but did
        //
        // Additional Info:
        //  Some context
    }
Exemple #2
0
    public void StringDoesNotMatchRegexObject()
    {
        Regex  pattern     = new Regex("...");
        string actualValue = "xxx";

        // MSTest
        MSTestStringAssert.DoesNotMatch(actualValue, pattern, "Some context");
        // StringAssert.DoesNotMatch failed. String 'xxx' matches pattern '...'. Some context.

        // NUnit does not support this case.

        // XUnit
        XUnitAssert.DoesNotMatch(pattern, actualValue);
        // Assert.DoesNotMatch() Failure:
        // Regex: ...
        // Value: xxx

        // Fluent does not support this case.

        // Shouldly does not support this case.
    }
Exemple #3
0
        public void SignalAddressRegExp_ShouldNotMatch(string input)
        {
            var regex = new Regex(Constants.SignalAddressRegExp, RegexOptions.IgnoreCase);

            Assert.DoesNotMatch(regex, input);
        }