public void Validate_NoValidationErrors_DontThrowException()
        {
            ReflectionLibrary.SetValueToReadonlyProperty(_validationResults.Object, typeof(ValidationResult),
                                                         "Errors", _emptyValidationFailures);

            Assert.DoesNotThrow(() => _service.Validate(_objectToValidate.Object));
        }
        public void Validate_ValidationFailed_ThrowValidationException()
        {
            ReflectionLibrary.SetValueToReadonlyProperty(_validationResults.Object, typeof(ValidationResult),
                                                         "Errors", _notEmptyValidationFailures);

            Assert.That(() => _service.Validate(_objectToValidate.Object), Throws.Exception.TypeOf <Common.Exceptions.ValidationException>());
        }
예제 #3
0
 public void NameOfParam_Of_Null_Is_Null()
 {
     Assert.IsNull(ReflectionLibrary.NameOfParam <object>(() => null));
 }
예제 #4
0
        public void NameOfParam_Of_Property_Is_Property_Name()
        {
            string foobarParam = "";

            Assert.AreEqual("foobarParam", ReflectionLibrary.NameOfParam(() => foobarParam));
        }
예제 #5
0
 public void NameOfProp_Of_Property_Is_Property_Name()
 {
     Assert.AreEqual("FooBar", ReflectionLibrary.NameOfProp(() => FooBar));
 }