示例#1
0
        public void Valid_GivenModelWithNoOptions_ValidationShouldPass()
        {
            var validator = new QuestionViewModelValidator();

            var model = new QuestionViewModel();

            var valid = validator.Validate(model);

            valid.IsValid.Should().BeTrue();
        }
示例#2
0
        public void Valid_GivenNoOptionsAreAvailableAndNoOptionSelected_ValidationShouldPass()
        {
            var validator = new QuestionViewModelValidator();

            var model = new QuestionViewModel()
            {
                Options = new List <OptionViewModel>()
            };

            var valid = validator.Validate(model);

            valid.IsValid.Should().BeTrue();
        }
示例#3
0
        public void Valid_GivenAnOptionHasBeenSelectedAndTheOptionHasNoAFurtherInformationQuestion_ValidationShouldPass()
        {
            var validator  = new QuestionViewModelValidator();
            var chosenGuid = Guid.NewGuid();

            var model = new QuestionViewModel()
            {
                Options = new List <OptionViewModel>()
                {
                    new OptionViewModel()
                    {
                        QuestionOptionId = Guid.NewGuid()
                    }
                },
                ChosenOption = chosenGuid
            };

            var valid = validator.Validate(model);

            valid.IsValid.Should().BeTrue();
        }
示例#4
0
        public void Valid_GivenAnOptionHasBeenSelectedAndTheOptionHasAFurtherInformationQuestionThatHasBeenAnswered_ValidationShouldPass()
        {
            var validator  = new QuestionViewModelValidator();
            var chosenGuid = Guid.NewGuid();

            var model = new QuestionViewModel()
            {
                Options = new List <OptionViewModel>()
                {
                    new OptionViewModel()
                    {
                        QuestionOptionId = chosenGuid,
                        FurtherQuestion  = "question"
                    }
                },
                ChosenOption                      = chosenGuid,
                FurtherInformationAnswer          = "answer",
                DisplayFurtherInformationQuestion = false
            };

            var valid = validator.Validate(model);

            valid.IsValid.Should().BeTrue();
        }