public void ReturnValidIfModelValid() { var model = GetValidModel(); var validationResults = StaticTestHelpers.GetValidationResults(model); Assert.Empty(validationResults); }
public void ReturnInvalidIfNameMissing() { var model = GetValidModel(); model.Name = null; var validationResults = StaticTestHelpers.GetValidationResults(model); Assert.Contains(validationResults, validationResult => validationResult.MemberNames.Contains("Name") && validationResult.ErrorMessage.ToLower().Contains("required")); }
public void ReturnInvalidIfNameTooShort() { var model = GetValidModel(); model.Name = StaticTestHelpers.GetRandomString(2); var validationResults = StaticTestHelpers.GetValidationResults(model); Assert.Contains(validationResults, validationResult => validationResult.MemberNames.Contains("Name") && validationResult.ErrorMessage.ToLower().Contains("min")); }
public void ReturnInvalidIfDescriptionTooLong() { var model = GetValidModel(); model.Description = StaticTestHelpers.GetRandomString(1000); var validationResults = StaticTestHelpers.GetValidationResults(model); Assert.Contains(validationResults, validationResult => validationResult.MemberNames.Contains("Description") && validationResult.ErrorMessage.ToLower().Contains("max")); }
public void ReturnValidIfDescriptionEmpty() { var model = GetValidModel(); model.Description = String.Empty; var validationResults = StaticTestHelpers.GetValidationResults(model); Assert.Empty(validationResults); }