Example #1
0
 public void ThrowsArgumentExceptionForWrongEnumValue()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Enum <Enum2> .ConvertFromOtherEnumValue(Enum1.MySecondValue));
 }
Example #2
0
 public void ThrowsArgumentNullExceptionifValidatorIsNull()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsValid("myParam", "value", (IValueValidator <string>)null));
 }
Example #3
0
 public void ThrowsArgumentExceptionForEmptyStringParamValue()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsNotNullOrEmpty("param", string.Empty));
 }
Example #4
0
 public void ThrowsArgumentExceptionForValueThatMatchWithThePattern()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsMatch("myParam", "\n", ".+"));
 }
Example #5
0
 public void ThrowsArgumentExceptionForNotValidFunc()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsValid("myParam", "value", () => false));
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsValid("myParam", "value", s => s.Length > 10));
 }
Example #6
0
 public void ThrowsNotSupportedExceptionForNotSupported()
 {
     ExceptionTester.CallMethodAndExpectException <NotSupportedException>(() => Argument.IsSupported(false, "Just not supported"));
 }
Example #7
0
 public void ThrowsArgumentExceptionForNullValue()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsMatch("myParam", null, ".+"));
 }
Example #8
0
 public void ThrowsArgumentExceptionForNullInstance()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => Argument.ImplementsInterface(null, null as object, typeof(IList)));
 }
Example #9
0
 public void ThrowsArgumentNullExceptionForNullInterfaceType()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => Argument.ImplementsInterface("myParam", typeof(List <int>), null));
 }
Example #10
0
 public void ThrowsArgumentOutOfRangeExceptionForTooSmallDoubleParamValue()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentOutOfRangeException>(() => Argument.IsMinimal("param", 2d, 3d));
 }
Example #11
0
 public void ThrowsArgumentOutOfRangeExceptionForTooLargeDoubleParamValue()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentOutOfRangeException>(() => Argument.IsMaximum("param", 3d, 2d));
 }
Example #12
0
 public void ThrowsArgumentOutOfRangeExceptionForTooLargeIntegerParamValue()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentOutOfRangeException>(() => Argument.IsNotOutOfRange("param", 3, 1, 2));
 }
Example #13
0
 public void ThrowsArgumentExceptionForEmptyByteArrayParamValue()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsNotNullOrEmptyArray("param", new byte[] { }));
 }
Example #14
0
 public void ThrowsArgumentExceptionForStringWithOnlySpacesParamValue()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsNotNullOrWhitespace("param", "  "));
 }
Example #15
0
 public void ThrowsArgumentExceptionForTypeImplementingNotRequiredType()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsNotOfType("myParam", typeof(PersonViewModel), typeof(ViewModelBase)));
 }
Example #16
0
 public void ThrowsArgumentNullExceptionForNullParamValue()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => Argument.IsNotNull("param", null));
 }
Example #17
0
 public void ThrowsArgumentExceptionForNullMessage()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsSupported(true, null));
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsSupported(true, string.Empty));
 }
Example #18
0
 public void ThrowsArgumentExceptionForTypeNotImplementingInterface()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.ImplementsInterface("myParam", typeof(List <int>), typeof(INotifyPropertyChanged)));
 }
Example #19
0
 public void ThrowsArgumentExceptionForValueThatMatchWithThePattern()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsNotMatch("myParam", "Match any single character that is not a line break character, between one and unlimited times", ".+"));
 }
Example #20
0
 public void ThrowsArgumentNullExceptionForNullInstance()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => Argument.InheritsFrom("myParam", null as object, typeof(Exception)));
 }
Example #21
0
 public void ThrowsArgumentExceptionForNullPattern()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsMatch("myParam", string.Empty, null));
 }
Example #22
0
 public void ThrowsArgumentNullExceptionForNullBaseType()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => Argument.InheritsFrom("myParam", typeof(Exception), null));
 }
Example #23
0
 public void ThrowsArgumentExceptionForNotValid()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsValid("myParam", "value", false));
 }
Example #24
0
 public void ThrowsArgumentExceptionForNullInstance()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsNotOfType(null, null as object, typeof(ViewModelLocator)));
 }
Example #25
0
 public void ThrowsArgumentNullExceptionIfFuncIsNull()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsValid("myParam", "value", (Func <string, bool>)null));
 }
Example #26
0
 public void ThrowsArgumentNullExceptionForNullType()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => Argument.IsNotOfType("myParam", null, typeof(ViewModelLocator)));
 }
Example #27
0
 public void ThrowsArgumentExceptionForNullGuidParamValue()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsNotNullOrEmpty("param", (Guid?)null));
 }
Example #28
0
 public void ThrowsArgumentNullExceptionForNullNotRequiredType()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => Argument.IsNotOfType("myParam", typeof(ViewLocator), null));
 }
Example #29
0
 public void ThrowsArgumentExceptionForEmptyGuidParamValue()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsNotEmpty("param", Guid.Empty));
 }
Example #30
0
 public void ThrowsArgumentExceptionForNonEnumValue()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Enum <Enum2> .ConvertFromOtherEnumValue(new object()));
 }