Beispiel #1
0
 public void When_calling_PassThroughNonLargerThan_with_values_larger_than_length_should_throw_ArgumentLengthLargerThanException(string testValue, int testLength)
 {
     AssertThatThrows <ArgumentLengthLargerThanException>(() => _ = StringGuardiansExtension.PassThroughNonLargerThan(testValue, testLength));
 }
Beispiel #2
0
 public void When_calling_PassThroughNonLargerThan_with_values_shorter_than_or_equal_to_length_should_return_input_as_output(string testValue, int testLength)
 {
     AssertThatReturnsInputAsOutput(() => StringGuardiansExtension.PassThroughNonLargerThan(testValue, testLength), testValue);
 }
Beispiel #3
0
        public void When_calling_PassThroughNonLargerThan_with_null_values_should_throw_ArgumentNullException(string testValue)
        {
            const int testLength = 0;

            AssertThatThrows <ArgumentNullException>(() => _ = StringGuardiansExtension.PassThroughNonLargerThan(testValue, testLength));
        }
Beispiel #4
0
 public void When_calling_PassThroughNonLargerThan_with_non_null_values_should_not_throw(string testValue, int testLength)
 {
     AssertThatReturnsInputAsOutput(() => StringGuardiansExtension.PassThroughNonLargerThan(testValue, testLength), testValue);
 }
Beispiel #5
0
        public void When_calling_PassThroughNonLargerThan_with_values_larger_than_length_with_custom_argumentName_and_custom_message_exception_properties_should_match(string testValue, int testLength)
        {
            const string testValueParamName = nameof(testValue);

            AssertThatExceptionParamNameAndMessageShouldMatch <ArgumentLengthLargerThanException>(() => _ = StringGuardiansExtension.PassThroughNonLargerThan(testValue, testLength, testValueParamName, TestCustomExceptionMessage), testValueParamName, TestCustomExceptionMessage);
        }
Beispiel #6
0
 public void When_calling_PassThroughNonLargerThan_with_values_larger_than_length_with_custom_message_exception_message_should_match(string testValue, int testLength)
 {
     AssertThatExceptionMessageShouldMatchCustomMessage <ArgumentLengthLargerThanException>(() => _ = StringGuardiansExtension.PassThroughNonLargerThan(testValue, testLength, message: TestCustomExceptionMessage));
 }
Beispiel #7
0
        public void When_calling_PassThroughNonLargerThan_with_values_larger_than_length_exception_argumentName_and_message_should_match_default(string testValue, int testLength)
        {
            testValue.ThrowIfNull(nameof(testValue));

            var defaultMessage = string.Format(CultureInfo.InvariantCulture, FlabIt.Guardians.Properties.Resources.Exception_ArgumentOfTypeXLargerThanMessageWithParamName, DefaultArgumentName, typeof(string).FullName, testLength, testValue.Length);

            AssertThatExceptionParamNameAndMessageShouldMatchDefaultArgumentName <ArgumentLengthLargerThanException>(() => _ = StringGuardiansExtension.PassThroughNonLargerThan(testValue, testLength), defaultMessage);
        }
Beispiel #8
0
        public void When_calling_PassThroughNonLargerThan_with_null_values_with_custom_argumentName_exception_argumentName_should_match(string testValue)
        {
            const string testValueParamName = nameof(testValue);
            const int    testLength         = 0;

            AssertThatExceptionParamNameShouldMatchCustomArgumentName <ArgumentNullException>(() => _ = StringGuardiansExtension.PassThroughNonLargerThan(testValue, testLength, testValueParamName), testValueParamName);
        }
Beispiel #9
0
        public void When_calling_PassThroughNonLargerThan_with_null_values_exception_argumentName_and_message_should_match_default(string testValue)
        {
            const int testLength = 0;

            var defaultMessage = string.Format(CultureInfo.InvariantCulture, FlabIt.Guardians.Properties.Resources.Exception_ArgumentNullMessageWithParamName, DefaultArgumentName);

            AssertThatExceptionParamNameAndMessageShouldMatchDefaultArgumentName <ArgumentNullException>(() => _ = StringGuardiansExtension.PassThroughNonLargerThan(testValue, testLength), defaultMessage);
        }