public void ValidateDate(string dateTime, int errorCount) { //Arrange var forecast = WeatherForecastBuilder.Builder().WithDate(DateTime.Parse(dateTime)).Build(); var sut = new WeatherForecastValidator(); //Act var validationResult = sut.Validate(forecast); //Assert validationResult.Should().HaveCount(errorCount); }
public IActionResult Get(BindModel data) { //Validate request if (WeatherForecastValidator.ValidateGet(data).IsSuccess) { return(Ok(new Response <List <string> > { Data = new List <string> { "Data A", "Data B" } })); } else { return(BadRequest(WeatherForecastValidator.ValidateGet(data))); } }