public IDomainModel CreateNewEvaluation(CreateEvaluationDomainModel createModel) { var evaluationModel = new EvaluationDomainModel(); var newEvaluationEntity = ConvertModelToEntity(createModel); var evaluationId = Guid.Empty; try { CalculateGrade(newEvaluationEntity); evaluationId = EvaluationInteractor.CreateEvaluation(newEvaluationEntity); } catch (GradeTrackerException gte) { return(new ErrorDomainModel(gte, true)); } try { evaluationModel = (EvaluationDomainModel)GetEvaluation(evaluationId); } catch (GradeTrackerException gte) { return(new ErrorDomainModel(gte, false)); } return(evaluationModel); }
public void CreateNewEvaluation_EmptyModel_ReturnsErrorModel() { var testClass = ServiceFactory.Create_EvaluationService(); var testModel = new CreateEvaluationDomainModel(); var result = testClass.CreateNewEvaluation(testModel); result.GetType().ShouldBe(typeof(ErrorDomainModel)); }
private static EvaluationEntity ConvertModelToEntity(CreateEvaluationDomainModel createModel) { return(new EvaluationEntity { Name = createModel.Name, CourseId = createModel.CourseId, Weight = createModel.Weight, NumberOfScores = createModel.NumberOfScores, PointsPerScore = createModel.PointsPerScore, DropLowest = createModel.DropLowest }); }
public IDomainModel CreateNewEvaluation(CreateEvaluationDomainModel createModel) { throw new NotImplementedException(); }