public void AddFormErrorCallsMethodInUnderlyingModelStateDictionary() { // Arrange var message = "This is a form error."; var dictionary = new ModelStateDictionary(); ValidationHelper validationHelper = GetValidationHelper(GetContext(), dictionary); // Act validationHelper.AddFormError(message); // Assert Assert.Equal(message, dictionary["_FORM"].Errors.Single()); }
public void GetErrorsReturnsFormErrors() { // Arrange string error = "Unable to connect to remote servers."; var modelStateDictionary = new ModelStateDictionary(); ValidationHelper validationHelper = GetValidationHelper(GetContext(), modelStateDictionary); // Act validationHelper.AddFormError(error); var errors = validationHelper.GetErrors(); // Assert Assert.Equal(error, errors.Single()); }