コード例 #1
0
        public void IsEqualTo_When_same_value_by_specific_compare_It_should_not_throw()
        {
            const string value    = "The value";
            const string expected = "the value";

            ShouldNotThrow(
                () => Ensure.That(value, ParamName).IsEqualTo(expected, StringComparison.OrdinalIgnoreCase),
                () => EnsureArg.IsEqualTo(value, expected, StringComparison.OrdinalIgnoreCase, ParamName));
        }
コード例 #2
0
        public void IsEqualTo_When_same_value_It_should_not_throw()
        {
            const string value    = "The value";
            const string expected = value;

            ShouldNotThrow(
                () => Ensure.That(value, ParamName).IsEqualTo(expected),
                () => EnsureArg.IsEqualTo(value, expected, ParamName));
        }
コード例 #3
0
        public void IsEqualTo_When_different_values_It_throws_ArgumentException()
        {
            const string value    = "The value";
            const string expected = "Other value";

            ShouldThrow <ArgumentException>(
                string.Format(ExceptionMessages.Strings_IsEqualTo_Failed, value, expected),
                () => Ensure.That(value, ParamName).IsEqualTo(expected),
                () => EnsureArg.IsEqualTo(value, expected, ParamName));
        }
コード例 #4
0
        public void IsEqualTo_When_same_value_by_specific_compare_It_should_not_throw()
        {
            const string value    = "The value";
            const string expected = "the value";

            var returnedValue = Ensure.That(value, ParamName).IsEqualTo(expected, StringComparison.OrdinalIgnoreCase);

            AssertReturnedAsExpected(returnedValue, value);

            Action a = () => EnsureArg.IsEqualTo(value, expected, StringComparison.OrdinalIgnoreCase, ParamName);

            a.ShouldNotThrow();
        }
コード例 #5
0
        public void IsEqualTo_When_same_value_It_should_not_throw()
        {
            const string value    = "The value";
            const string expected = value;

            var returnedValue = Ensure.That(value, ParamName).IsEqualTo(expected);

            AssertReturnedAsExpected(returnedValue, value);

            Action a = () => EnsureArg.IsEqualTo(value, expected, ParamName);

            a.ShouldNotThrow();
        }