public void IsNotEqualTo_When_different_values_by_casing_using_case_sensitive_compare_It_should_not_throw()
        {
            var value = "The value";

            ShouldNotThrow(
                () => Ensure.That(value, ParamName).IsNotEqualTo(value.ToLower(), StringComparison.Ordinal),
                () => EnsureArg.IsNotEqualTo(value, value.ToLower(), StringComparison.Ordinal, ParamName));
        }
        public void IsNotEqualTo_When_different_values_It_should_not_throw()
        {
            var value = "The value";

            ShouldNotThrow(
                () => Ensure.That(value, ParamName).IsNotEqualTo(value + "a"),
                () => EnsureArg.IsNotEqualTo(value, value + "a", ParamName));
        }
        public void IsNotEqualTo_When_same_values_It_throws_ArgumentException()
        {
            const string value = "The value";

            ShouldThrow <ArgumentException>(
                string.Format(ExceptionMessages.Comp_IsNot_Failed, value, value),
                () => Ensure.That(value, ParamName).IsNotEqualTo(value),
                () => EnsureArg.IsNotEqualTo(value, value, ParamName));
        }
        public void IsNotEqualTo_When_different_values_by_casing_using_non_case_sensitive_compare_It_throws_ArgumentException()
        {
            const string value     = "The value";
            var          compareTo = value.ToLower();

            ShouldThrow <ArgumentException>(
                string.Format(ExceptionMessages.Comp_IsNot_Failed, value, compareTo),
                () => Ensure.That(value, ParamName).IsNotEqualTo(compareTo, StringComparison.OrdinalIgnoreCase),
                () => EnsureArg.IsNotEqualTo(value, compareTo, StringComparison.OrdinalIgnoreCase, ParamName));
        }
Ejemplo n.º 5
0
        public void IsNotEqualTo_When_different_values_by_casing_using_case_sensitive_compare_It_should_not_throw()
        {
            var value = "The value";

            var returnedValue = Ensure.That(value, ParamName).IsNotEqualTo(value.ToLower(), StringComparison.Ordinal);

            AssertReturnedAsExpected(returnedValue, value);

            Action a = () => EnsureArg.IsNotEqualTo(value, value.ToLower(), StringComparison.Ordinal, ParamName);

            a.ShouldNotThrow();
        }
Ejemplo n.º 6
0
        public void IsNotEqualTo_When_different_values_It_should_not_throw()
        {
            var value = "The value";

            var returnedValue = Ensure.That(value, ParamName).IsNotEqualTo(value + "a");

            AssertReturnedAsExpected(returnedValue, value);

            Action a = () => EnsureArg.IsNotEqualTo(value, value + "a", ParamName);

            a.ShouldNotThrow();
        }