public void GetScoresByEvalId_DiffGuidExistingScores_ReturnsZero() { var testGuid = Guid.NewGuid(); var testScores = ScoreFactory.Create_ListOfScoreEntity(testGuid); var testRepo = new MockRepository <ScoreEntity>(testScores); var testClass = InteractorFactory.Create_ScoreInteractor(testRepo); var result = testClass.GetScoresByEvaluationId(Guid.NewGuid()); result.Count.ShouldBe(0); }
public void GetScoresByEvalId_ExistingScores_ReturnsThree() { var testGuid = Guid.NewGuid(); var testScores = ScoreFactory.Create_ListOfScoreEntity(testGuid); var testRepo = new MockRepository <ScoreEntity>(testScores); var testClass = InteractorFactory.Create_ScoreInteractor(testRepo); var result = testClass.GetScoresByEvaluationId(testGuid); var allGradeResults = result.All(s => s.PointsGrade == .8); result.Count.ShouldBe(3); allGradeResults.ShouldBe(true); }
public void DeleteScore_ValidGuid_RemovesScore() { var evalGuid = Guid.NewGuid(); var testList = ScoreFactory.Create_ListOfScoreEntity(evalGuid); var testRepo = new MockRepository <ScoreEntity>(testList); var testClass = InteractorFactory.Create_ScoreInteractor(testRepo); var testGuid = testRepo.GetAll().First().Id; testClass.DeleteScore(testGuid); var result = testClass.GetScoresByEvaluationId(evalGuid); result.Count.ShouldBe(2); }
public void UpdateScore_ValidObject_UpdatesScore() { var evalGuid = Guid.NewGuid(); var testList = ScoreFactory.Create_ListOfScoreEntity(evalGuid); var testRepo = new MockRepository <ScoreEntity>(testList); var testClass = InteractorFactory.Create_ScoreInteractor(testRepo); var scoreToUpdate = testRepo.GetAll().First(); var updatedScore = new ScoreEntity { Id = scoreToUpdate.Id, PointsPossible = 5, PointsEarned = 4, PointsGrade = .8 }; testClass.UpdateScore(updatedScore); var result = testClass.GetScore(scoreToUpdate.Id); result.LastModified.ShouldNotBeSameAs(scoreToUpdate.LastModified); result.PointsEarned.ShouldBe(4); result.PointsPossible.ShouldBe(5); result.PointsGrade.ShouldBe(.8); }
public void DeleteEvaluation_ScoresPresent_DeletesScores() { var testEvalId = Guid.NewGuid(); var testEval = EvaluationFactory.Create_EvaluationEntity_ValidMinimum_CustomId(testEvalId); var testDomainModel = new EvaluationDomainModel(testEval); var testScores = ScoreFactory.Create_ListOfScoreEntity(testEvalId); var testScoreRepo = new MockRepository <ScoreEntity>(testScores); var scoreInteractor = TestDatas.Scores.InteractorFactory.Create_ScoreInteractor(); scoreInteractor.Repo = testScoreRepo; var mockEvalInteractor = TestDatas.Evaluations.InteractorFactory.Create_MockEvaluationInteractor(); var testClass = ServiceFactory.Create_EvaluationService(); testClass.EvaluationInteractor = mockEvalInteractor; testClass.ScoreInteractor = scoreInteractor; var result = testClass.DeleteEvaluation(testEvalId); var resultScores = testClass.ScoreInteractor.GetScoresByEvaluationId(testEvalId); result.GetType().ShouldNotBe(typeof(ErrorDomainModel)); resultScores.Count.ShouldBe(0); }
public List <ScoreEntity> GetScoresByEvaluationId(Guid evaluationId) { return(ScoreFactory.Create_ListOfScoreEntity(evaluationId)); }