示例#1
0
        public void TestWhenCreatedThenLoadQuestionCommandContainsCorrectGroupId()
        {
            //Assign
            QuestionGroup group = new QuestionGroup(10);

            //Act
            QuestionGroupViewModel viewModel = new QuestionGroupViewModel(group);

            //Assert
            Assert.IsTrue(((LoadQuestionCommand)viewModel.LoadQuestionCommand).GroupId == group.Id);
        }
示例#2
0
        public void TestWhenLoadQuestionThenQuestionMarkAsAnswered()
        {
            //Assign
            QuestionGroupViewModel viewModel = new QuestionGroupViewModel(new QuestionGroup(10, new List<Question>()
                                                                                                {
                                                                                                    new Question()
                                                                                                        {
                                                                                                            Cost = 30
                                                                                                        }
                                                                                                }));

            //Act
            viewModel.LoadQuestionCommand.Execute(viewModel.Questions.First().Model.Cost);

            //Assert
            Assert.IsTrue(viewModel.Questions.First().IsAnswered);
        }
示例#3
0
        public void TestWhenAskLoadQuestionThatDonotExistsThenThrowArgumentOutOfRangeException()
        {
            //Assign
            QuestionGroupViewModel viewModel = new QuestionGroupViewModel(new QuestionGroup());

            try
            {
                //Act
                viewModel.LoadQuestionCommand.Execute(30);

                //Assert
                Assert.Fail("Exception was not throw");
            }
            catch (ArgumentOutOfRangeException)
            {

            }
            catch(Exception)
            {
                Assert.Fail("Exception with not correct type");
            }
        }