コード例 #1
0
 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);
 }
コード例 #2
0
        public AssessmentValidationTests()
        {
            _assValidator = new AssessmentValidator();

            _assessmentRequest = new AssessmentRequestModel {
                Duration = 1, Instructions = "My instructions", Name = "My Assessment Name"
            };
        }
コード例 #3
0
        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);
            }
        }