コード例 #1
0
        public void DifferentType_DescribeMismatch_IncludesTheMismatch()
        {
            // Given
            TypeSafeMatcherSubClass <string> matcher = new TypeSafeMatcherSubClass <string>();
            char value = 'c';

            // When
            TestHelper.AssertMismatchDescription($"was a Char (\"{value}\")", matcher, value);

            // Then - No exception
        }
コード例 #2
0
        public void DifferentValueSameType_DescribeMismatch_IncludesTheMismatch()
        {
            // Given
            TypeSafeMatcherSubClass <string> matcher = new TypeSafeMatcherSubClass <string>();
            string value = "differentValue";

            // When
            TestHelper.AssertMismatchDescription($"was \"{value}\"", matcher, value);

            // Then - No exception
        }
コード例 #3
0
        public void NullValue_DescribeMismatch_IncludesWasNull()
        {
            // Given
            TypeSafeMatcherSubClass <string> matcher = new TypeSafeMatcherSubClass <string>();
            string value = null;

            // When
            TestHelper.AssertMismatchDescription("was null", matcher, value);

            // Then - No exception
        }
コード例 #4
0
        public void DifferentTypeNullable_DescribeMismatch_IncludesType()
        {
            // Given
            TypeSafeMatcherSubClass <string> matcher = new TypeSafeMatcherSubClass <string>();
            int?value = null;

            // When
            TestHelper.AssertMismatchDescription("was null", matcher, value);

            // Then - No exception
        }
コード例 #5
0
        public void GivenDifferntTypeOfString_Matches_EnsuresTypeIsUnsafeAndReturnsFalse()
        {
            // Given
            TypeSafeMatcherSubClass <int> matcher = new TypeSafeMatcherSubClass <int>();
            string value = "asdf";

            // When
            bool matches = matcher.Matches(value);

            // Then
            Xunit.Assert.False(matches);
        }