public override void Given() { Logger = new Logger <CsvHelperService <AssessmentCsvRecordRequest, CsvResponseModel <AssessmentCsvRecordResponse>, AssessmentCsvRecordResponse> >(new NullLoggerFactory()); DataParser = new AssessmentParser(); Validator = new AssessmentValidator(); Service = new CsvHelperService <AssessmentCsvRecordRequest, CsvResponseModel <AssessmentCsvRecordResponse>, AssessmentCsvRecordResponse>(Validator, DataParser, Logger); FilePath = Path.Combine(Path.GetDirectoryName(GetCodeBaseAbsolutePath()), _dataFilePath); }
public AssessmentValidationTests() { _assValidator = new AssessmentValidator(); _assessmentRequest = new AssessmentRequestModel { Duration = 1, Instructions = "My instructions", Name = "My Assessment Name" }; }
public Assessment Update(Assessment assessment) { AssessmentValidator validator = new AssessmentValidator(); var results = validator.Validate(assessment); if (results.IsValid) { repository.Update(assessment); UoW.Commit(); return(assessment); } else { var errors = results.Errors.Select(e => e.ErrorMessage).ToList(); throw new BusinessException(errors); } }