Exemplo n.º 1
0
        public QuestionProcessViewModel()
        {
            #region Designer mode
            if (IsInDesignMode)
            {
                var question = new Question()
                                   {
                                       Answer = "Qanswer",
                                       AnswerImage = DesignDataQuestionService.LoadImage(),
                                       Cost = 100,
                                       Id = 1,
                                       QuestionGroup = new QuestionGroup(1) {Name = "Test Group"},
                                       Text = "The World Wide Web has succeeded in large " +
                                              "part because its software architecture has been designed " +
                                              "to meet the needs of an Internet-scale distributed hypermedia system"
                                   };
                OnLoadQuestion(new LoadQuestionMessage(question));
                GoToNextStateCommand.Execute();
                GoToNextStateCommand.Execute();
            }
            #endregion

            MessengerInstance.Register<LoadQuestionMessage>(this, OnLoadQuestion);
            MessengerInstance.Register<UnloadQuestionMessage>(this, OnUnloadQuestion);

            CancelQuestionCommand = new RelayCommand(() => Messenger.Default.Send(new CancelQuestionMessage(Model)));
        }
Exemplo n.º 2
0
        public void TestWhenUnloadQuestionMessageTriggeredThenCommandResultsSetInnactive()
        {
            //Assign
            CommandResultsViewModel viewModel = new CommandResultsViewModel();
            viewModel.InitializeCommands(5);
            Question question = new Question();
            Messenger.Default.Send(new LoadQuestionMessage(question));

            //Act
            Messenger.Default.Send(new UnloadQuestionMessage());

            //Assert
            Assert.IsTrue(viewModel.CommandResults.All(rec => !rec.IsActive));
        }
Exemplo n.º 3
0
        public void TestWhenLoadQuestionMessageTriggeredThenCommandResultsSetActive()
        {
            //Assign
            CommandResultsViewModel viewModel = new CommandResultsViewModel();
            viewModel.InitializeCommands(5);
            Question question = new Question() {Cost = 999};

            //Act
            Messenger.Default.Send(new LoadQuestionMessage(question));

            //Assert
            Assert.IsTrue(viewModel.CommandResults.All(rec => rec.CurrentBet == question.Cost));
            Assert.IsTrue(viewModel.CommandResults.All(rec => rec.IsActive));
        }
Exemplo n.º 4
0
 public QuestionViewModel(Question model)
 {
     Model = model;
     IsAnswered = false;
 }