コード例 #1
0
        public void UpdateScore_NewObject_ThrowsObjectNotFound()
        {
            var testClass = InteractorFactory.Create_ScoreInteractor();

            var testScore = ScoreFactory.Create_ScoreEntity_ValidMinimum();

            Should.Throw <ObjectNotFoundException>(() => testClass.UpdateScore(testScore));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        public ScoreEntity GetScore(Guid scoreId)
        {
            if (scoreId.Equals(Guid.Empty))
            {
                throw new ObjectNotFoundException();
            }

            return(ScoreFactory.Create_ScoreEntity_ValidMinimum(scoreId));
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        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));
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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);
        }