Beispiel #1
0
        public TriviaGamePresenter(TriviaGameView view, Question[] questions)
        {
            _view      = view;
            _questions = questions;

            Score            = 0;
            _currentQuestion = 0;

            _view.ShowNextQuestion(_questions[_currentQuestion]);
        }
Beispiel #2
0
    public void When_Right_Answer_Shows_Positive_Feedback()
    {
        //Given
        TriviaGameView  triviaGameView  = Substitute.For <TriviaGameView>();
        TriviaPresenter triviaPresenter = new TriviaPresenter(triviaGameView);

        //When
        triviaPresenter.SetAnswer("ok");

        //Then
        triviaGameView.Received(1).ShowPositiveFeedBack();
    }
Beispiel #3
0
        public void SetUp()
        {
            _view      = Substitute.For <TriviaGameView>();
            _presenter = new TriviaGamePresenter(_view, new Question[] { _firstQuestion, _secondQuestion, _thirdQuestion });

            _firstQuestion.IsRightAnswer("ok").Returns(true);
            _firstQuestion.IsRightAnswer("nope").Returns(false);

            _secondQuestion.IsRightAnswer("ok").Returns(true);
            _secondQuestion.IsRightAnswer("nope").Returns(false);

            _thirdQuestion.IsRightAnswer("ok").Returns(true);
            _thirdQuestion.IsRightAnswer("nope").Returns(false);
        }
Beispiel #4
0
 public TriviaPresenter(TriviaGameView triviaGameView)
 {
 }
Beispiel #5
0
 public static TriviaGamePresenter BuildTriviaGamePresenter(TriviaGameView view)
 {
     return(new TriviaGamePresenter(view, ServicesProvider.QuestionsService().GetQuestions(3)));
 }