public void MethodNameIsExpected() { var testCallBackValidatorAttribute = new CallbackValidatorAttribute { CallbackMethodName = "12345" }; Assert.Equal("12345", testCallBackValidatorAttribute.CallbackMethodName); }
public void TypeIsExpected() { var testCallBackValidatorAttribute = new CallbackValidatorAttribute { Type = typeof(double) }; Assert.Equal(typeof(double), testCallBackValidatorAttribute.Type); }
public void GetValidatorInstance_CallBackMethodNullThrows() { var testCallBackValidatorAttribute = new CallbackValidatorAttribute { Type = typeof(double) }; Assert.Throws <ArgumentException>(() => testCallBackValidatorAttribute.ValidatorInstance); }
public void GetValidatorInstance_MethodHasTooManyParameters() { var testCallBackValidatorAttribute = new CallbackValidatorAttribute { Type = typeof(CallBackValidatorAttributeTests), CallbackMethodName = "CallBackValidatorTestMethodNumberTwo" }; Assert.Throws <ArgumentException>(() => testCallBackValidatorAttribute.ValidatorInstance); }
public void SuccessfulCallback_CallTwice() { var testCallBackValidatorAttribute = new CallbackValidatorAttribute { Type = typeof(CallBackValidatorAttributeTests), CallbackMethodName = "CallBackValidatorTestMethod" }; var response = testCallBackValidatorAttribute.ValidatorInstance; Assert.IsType <CallbackValidator>(testCallBackValidatorAttribute.ValidatorInstance); }
public void GetValidatorInstance_DefaultConstructorThrows() { var testCallBackValidatorAttribute = new CallbackValidatorAttribute(); Assert.Throws <ArgumentNullException>(() => testCallBackValidatorAttribute.ValidatorInstance); }