Ejemplo n.º 1
0
        public void NotValidWhenQuestionScoresIsNull()
        {
            // Arrange
            var model = new BaseScoreCardViewModel { QuestionScores = null };

            // Act
            var isValid = Validator.TryValidateObject(model, new ValidationContext(model), null);

            // Assert
            Assert.False(isValid);
        }
Ejemplo n.º 2
0
        public void NotValidWhenOneQuestionScoreIsUndecided()
        {
            // Arrange
            var model = new BaseScoreCardViewModel
            {
                QuestionScores = new List<QuestionScoreViewModel>
                {
                    new QuestionScoreViewModel { Score = Score.Absent },
                    new QuestionScoreViewModel { Score = Score.Excellent },
                    new QuestionScoreViewModel { Score = Score.Undecided },
                }
            };

            // Act
            var isValid = Validator.TryValidateObject(model, new ValidationContext(model), null);

            // Assert
            Assert.False(isValid);
        }