public void UpdateScore_NewObject_ThrowsObjectNotFound() { var testClass = InteractorFactory.Create_ScoreInteractor(); var testScore = ScoreFactory.Create_ScoreEntity_ValidMinimum(); Should.Throw <ObjectNotFoundException>(() => testClass.UpdateScore(testScore)); }
public void CreateScore_MinimumEntity_ReturnsNewGuid() { var testClass = InteractorFactory.Create_ScoreInteractor(); var testScore = ScoreFactory.Create_ScoreEntity_ValidMinimum(); var result = testClass.CreateScore(testScore); result.ShouldNotBe(Guid.Empty); }
public ScoreEntity GetScore(Guid scoreId) { if (scoreId.Equals(Guid.Empty)) { throw new ObjectNotFoundException(); } return(ScoreFactory.Create_ScoreEntity_ValidMinimum(scoreId)); }
public void UpdateScore_ValidModel_ReturnsValidModel() { var testScoreEntity = ScoreFactory.Create_ScoreEntity_ValidMinimum(Guid.NewGuid()); var testScore = new ScoreDomainModel(testScoreEntity); var testClass = ServiceFactory.Create_ScoreService(); var result = testClass.UpdateScore(testScore); result.GetType().ShouldNotBe(typeof(ErrorDomainModel)); }
public void CreateScore_DuplicateEntry_ThrowsObjectAlreadyExists() { var testRepo = new MockRepository <ScoreEntity>(); var testScore = ScoreFactory.Create_ScoreEntity_ValidMinimum(); var testGuid = testRepo.Create(testScore); var testClass = InteractorFactory.Create_ScoreInteractor(testRepo); var duplicateScore = ScoreFactory.Create_ScoreEntity_ValidMinimum(); Should.Throw <ObjectAlreadyExistsException>(() => testClass.CreateScore(duplicateScore)); }
public void GetScore_ValidGuid_GetsValidModel() { var testRepo = new MockRepository <ScoreEntity>(); var testScore = ScoreFactory.Create_ScoreEntity_ValidMinimum(); var testGuid = testRepo.Create(testScore); var testClass = ServiceFactory.Create_ScoreService(); var result = testClass.GetScore(testGuid); result.Name.ShouldNotBe(string.Empty); }
public void GetScore_ExistingScore_ReturnsScore() { var testRepo = new MockRepository <ScoreEntity>(); var testScore = ScoreFactory.Create_ScoreEntity_ValidMinimum(); var testGuid = testRepo.Create(testScore); var testClass = InteractorFactory.Create_ScoreInteractor(testRepo); var result = testClass.GetScore(testGuid); result.Name.ShouldNotBe(string.Empty); result.Id.ShouldBe(testGuid); result.PointsGrade.ShouldBe(.8); result.PointsEarned.ShouldBe(8); result.PointsPossible.ShouldBe(10); }