public void ValidateString(string input, string key, int minLength, int maxLength, bool expectedIsValid, int expectedNumberOfValidationResults, string[] expectedErrors, string displayMessage) { // arrange IResponseCreator responseCreator = ResponseCreatorDataFactory.Create(); var inputValidator = new InputValidator <string>(input, responseCreator); // act inputValidator.ForString(x => x, key) .MinLength(minLength, MinLengthValidationResultMessage) .MaxLength(maxLength, MaxLengthValidationResultMessage); var actual = responseCreator.IsValid(); var actualNumberOfValidationResultsForKey = responseCreator.NumberOfValidationResultsForKey(key); var actualValidationResults = responseCreator.GetValidationResultsForKey(key); // assert actual.ShouldBe(expectedIsValid, customMessage: displayMessage); actualNumberOfValidationResultsForKey.ShouldBe(expectedNumberOfValidationResults, customMessage: displayMessage); responseCreator.GetValidationResultsForKey(key).Count().ShouldBe(expectedErrors.Length); expectedErrors.ToList().ForEach(expectedError => { actualValidationResults.ShouldContain(expectedError); }); }