Esempio n. 1
0
        public void No_match_if_object_is_null()
        {
            var matcher = new TestNonNullMatcher(s => true);

            var match = matcher.Matches(null);

            Assert.False(match, "Expected no match for null.");
        }
Esempio n. 2
0
        public void Describe_mismatch_safely()
        {
            var matcher     = new TestNonNullMatcher(s => false);
            var description = new StringDescription();

            matcher.DescribeMismatchSafely2("something", description);

            Assert.Equal("was \"something\"", description.ToString());
        }
Esempio n. 3
0
        public void Use_base_mismatch_description_when_null()
        {
            var matcher     = new TestNonNullMatcher(s => true);
            var description = new StringDescription();

            matcher.DescribeMismatch(null, description);

            Assert.Equal("was null", description.ToString());
        }
Esempio n. 4
0
        public void Use_mismatch_description_when_not_null()
        {
            var matcher     = new TestNonNullMatcher(s => false);
            var description = new StringDescription();

            matcher.DescribeMismatch("", description);

            Assert.Equal("TestNonNullMatcher.DescribeMismatchSafely", description.ToString());
        }
Esempio n. 5
0
        public void Pass_to_MatchesSafely_if_not_null()
        {
            var flag    = false;
            var matcher = new TestNonNullMatcher(s => { flag = true; return(true); });

            matcher.Matches("");

            Assert.True(flag, "Expected MatchesSafely(string, IDescription) to be called.");
        }