示例#1
0
        public void CreateNewScore_EmptyModel_ReturnsErrorModel()
        {
            var testClass = ServiceFactory.Create_ScoreService();
            var testModel = ScoreFactory.Create_CreateScoreDomainModel_Empty();

            Should.Throw <MissingInfoException>(() => testClass.CreateNewScore(testModel));
        }
示例#2
0
        public void DeleteScore_EmptyGuid_ReturnsErrorModel()
        {
            var testGuid  = Guid.Empty;
            var testClass = ServiceFactory.Create_ScoreService();

            var result = testClass.DeleteScore(testGuid);

            result.GetType().ShouldBe(typeof(ErrorDomainModel));
        }
示例#3
0
        public void CreateNewScore_ValidMin_ReturnsGoodName()
        {
            var testClass = ServiceFactory.Create_ScoreService();
            var testModel = ScoreFactory.Create_CreateScoreDomainModel_ValidMinimum();

            var result = testClass.CreateNewScore(testModel);

            result.Name.ShouldNotBe(string.Empty);
        }
示例#4
0
        public void DeleteScore_ValidGuid_DeletesObject()
        {
            var evaluation = Guid.NewGuid();

            var testClass = ServiceFactory.Create_ScoreService();

            var result = testClass.DeleteScore(evaluation);

            result.GetType().ShouldNotBe(typeof(ErrorDomainModel));
        }
示例#5
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));
        }
示例#6
0
        public void UpdateScore_EmptyGuid_ReturnsErrorModel()
        {
            var testScore = new ScoreDomainModel {
                Id = Guid.Empty
            };
            var testClass = ServiceFactory.Create_ScoreService();

            var result = testClass.UpdateScore(testScore);

            result.GetType().ShouldBe(typeof(ErrorDomainModel));
        }
示例#7
0
        public void CreateNewScore_ValidMin_Returns80Percent()
        {
            var testClass = ServiceFactory.Create_ScoreService();
            var testModel = ScoreFactory.Create_CreateScoreDomainModel_80Percent();

            var result = testClass.CreateNewScore(testModel);

            var castedResult = (ScoreDomainModel)result;

            castedResult.PointsGrade.ShouldBe(.8);
        }
示例#8
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);
        }