Beispiel #1
0
 public void ThrowsArgumentExceptionForNullMessage()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsSupported(true, null));
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsSupported(true, string.Empty));
 }
Beispiel #2
0
 public void ThrowsArgumentExceptionForNullExpression()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => Argument.IsNotNullOrEmpty((Expression <Func <string> >)null));
     ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => Argument.IsNotNullOrEmpty((Expression <Func <Guid> >)null));
     ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => Argument.IsNotNullOrEmpty((Expression <Func <Guid?> >)null));
 }
Beispiel #3
0
 public void ThrowsInvalidOperationExceptionWhenEverythingIsStatic()
 {
     ExceptionTester.CallMethodAndExpectException <InvalidOperationException>(() => WeakEventListener <EventListener, EventSource, EventArgs> .SubscribeToWeakGenericEvent(null, null, "StaticEvent", EventListener.OnEventStaticHandler));
 }
Beispiel #4
0
 public void ThrowsArgumentNullExceptionForNullExpression2()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => Argument.IsValid(null, (Func <object, bool>)null));
 }
Beispiel #5
0
 public void ThrowsArgumentExceptionForIsValidInvokation2()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => this.IsValidInvokation("myValue", s => s.Length > 10));
 }
Beispiel #6
0
 public void ThrowsArgumentNullExceptionForNullParameterInvokation()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => IsNotNullInvokation(null));
 }
Beispiel #7
0
 public void ThrowsArgumentExceptionForNullExpression()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => Argument.IsNotMatch(null, null));
 }
Beispiel #8
0
 public void ThrowsArgumentExceptionForNotValid()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsValid("myParam", "value", false));
 }
Beispiel #9
0
 public void ThrowsArgumentExceptionForNotValidFunc()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsValid("myParam", "value", () => false));
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsValid("myParam", "value", s => s.Length > 10));
 }
Beispiel #10
0
 public void ThrowsArgumentExceptionForNullPattern()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsMatch("myParam", string.Empty, null));
 }
Beispiel #11
0
 public void ThrowsArgumentExceptionForValueThatMatchWithThePattern()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsMatch("myParam", "\n", ".+"));
 }
Beispiel #12
0
 public void ThrowsArgumentExceptionForNullValue()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsMatch("myParam", null, ".+"));
 }
Beispiel #13
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", ".+"));
 }
Beispiel #14
0
 public void ThrowsNotSupportedExceptionForNotSupported()
 {
     ExceptionTester.CallMethodAndExpectException <NotSupportedException>(() => Argument.IsSupported(false, "Just not supported"));
 }
Beispiel #15
0
 public void ThrowsArgumentExceptionForNullExpression()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => Argument.IsOfType <object>(null, typeof(IList)));
 }
Beispiel #16
0
 public void ThrowsArgumentNullExceptionIfFuncIsNull()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsValid("myParam", "value", (Func <string, bool>)null));
 }
Beispiel #17
0
 public void ThrowsArgumentExceptionForIsOfTypeInvokation()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => IsOfTypeInvokation(new List <int>(), typeof(INotifyPropertyChanged)));
 }
Beispiel #18
0
 public void ThrowsArgumentNullExceptionifValidatorIsNull()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsValid("myParam", "value", (IValueValidator <string>)null));
 }
Beispiel #19
0
 public void ThrowsArgumentExceptionForIsMatchInvokation()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => IsMatchInvokation("Match a single digit, between one and unlimited times", "\\d+"));
 }
Beispiel #20
0
 public void ThrowsArgumentExceptionForNullGuidParamValue()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsNotNullOrEmpty("param", (Guid?)null));
 }
Beispiel #21
0
 public void ThrowsArgumentExceptionForIsNotMatchInvokation()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => IsNotMatchInvokation("Match any single character that is not a line break character, between one and unlimited times", ".+"));
 }
Beispiel #22
0
 public void ThrowsArgumentExceptionForEmptyStringParamValue()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsNotNullOrEmpty("param", string.Empty));
 }
Beispiel #23
0
 public void ThrowsArgumentNullExceptionifValidatorIsNull2()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => Argument.IsValid(() => string.Empty, (IValueValidator <string>)null));
 }
Beispiel #24
0
 public void ThrowsArgumentExceptionForEmptyGuidParamValue()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsNotEmpty("param", Guid.Empty));
 }
Beispiel #25
0
 public void ThrowsArgumentExceptionForIsValidInvokation3()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => this.IsValidInvokation("myValue", false));
 }
Beispiel #26
0
 public void ThrowsArgumentExceptionForNullOrWhitespaceInvokation()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => IsNotNullOrWhitespaceInvokation(string.Empty));
 }
Beispiel #27
0
 public void ThrowsArgumentNullExceptionForNullPropertyExpression()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => ExpressionHelper.GetOwner <object>(null));
 }
Beispiel #28
0
 public void ThrowsArgumentExceptionForNullOrEmptyArrayParameterInvokation()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => IsNotNullOrEmptyArrayInvokation(new object[] { }));
 }
Beispiel #29
0
            public void ThrowsArgumentNullExceptionForNullSource()
            {
                var listener = new EventListener();

                ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => listener.SubscribeToWeakGenericEvent <ViewModelClosedEventArgs>(null, "event", listener.OnPublicEvent));
            }
Beispiel #30
0
 public void ThrowsArgumentExceptionForTypeImplementingNotRequiredType()
 {
     ExceptionTester.CallMethodAndExpectException <ArgumentException>(() => Argument.IsNotOfType("myParam", typeof(PersonViewModel), typeof(ViewModelBase)));
 }