public void Test_Validate_Should_Return_Errors() { // Arrange var ValidateService = new ValidateService(); var testClass = new TestClassWithAttrs(); // Act var errors = ValidateService.Validate(testClass); // Assert Assert.AreSame(testClass, errors.Object); Assert.AreEqual(10, errors.Errors.Length); CollectionAssert.AreEquivalent( new[] { new ValidationError("staticproperty", "Static_Property"), new ValidationError("publicproperty", "Public_Property"), new ValidationError("internalproperty", "Internal_Property"), new ValidationError("protectedproperty", "Protected_Property"), new ValidationError("privateproperty", "Private_Property"), new ValidationError("staticmethod", "Static_Method"), new ValidationError("publicmethod", "Public_Method"), new ValidationError("internalmethod", "Internal_Method"), new ValidationError("protectedmethod", "Protected_Method"), new ValidationError("privatemethod", "Private_Method") }, errors.Errors); }
public void Validate_Should_Return_Errors() { // Arrange var validator = new ValidationHelper(); var testClass = new TestClassWithAttrs(); // Act var errors = validator.Validate(testClass); // Assert Assert.AreSame(testClass, errors.Object); Assert.AreEqual(10, errors.Errors.Count); CollectionAssert.AreEquivalent( new[] { new ValidationError("staticproperty", "Static_Property"), new ValidationError("publicproperty", "Public_Property"), new ValidationError("internalproperty", "Internal_Property"), new ValidationError("protectedproperty", "Protected_Property"), new ValidationError("privateproperty", "Private_Property"), new ValidationError("staticmethod", "Static_Method"), new ValidationError("publicmethod", "Public_Method"), new ValidationError("internalmethod", "Internal_Method"), new ValidationError("protectedmethod", "Protected_Method"), new ValidationError("privatemethod", "Private_Method") }, errors.Errors.ToArray()); }
public void Validate_Should_Return_Errors() { // Arrange var validator = new Validator(); var testClass = new TestClassWithAttrs(); // Act var errors = validator.Validate(testClass); // Assert Assert.AreSame(testClass, errors.Object); Assert.AreEqual(10, errors.Errors.Length); CollectionAssert.AreEquivalent( new[] { new ValidationError("staticproperty", "Static_Property"), new ValidationError("publicproperty", "Public_Property"), new ValidationError("internalproperty", "Internal_Property"), new ValidationError("protectedproperty", "Protected_Property"), new ValidationError("privateproperty", "Private_Property"), new ValidationError("staticmethod", "Static_Method"), new ValidationError("publicmethod", "Public_Method"), new ValidationError("internalmethod", "Internal_Method"), new ValidationError("protectedmethod", "Protected_Method"), new ValidationError("privatemethod", "Private_Method") }, errors.Errors); }
public void CheckIsValid_Should_Throw_ValidationException() { // Arrange var validator = new ValidationHelper(); var testClass = new TestClassWithAttrs(); // Act validator.CheckIsValid(testClass); }
public void IsValid_Should_Return_False() { // Arrange var validator = new ValidationHelper(); var testClass = new TestClassWithAttrs(); // Act var errors = validator.IsValid(testClass); // Assert Assert.IsFalse(errors); }