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

            var model = new QuestionViewModel();

            var valid = validator.Validate(model);

            valid.IsValid.Should().BeTrue();
        }
Example #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();
        }
Example #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();
        }
Example #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();
        }