Exemplo n.º 1
0
 public void TestNextQuestion()
 {
     _instance.NextQuestion();
     Assert.IsTrue(_instance.Status == ESpeakerListStatus.SpeakerPaused);
     Assert.NotNull(_instance.CurrentSpeaker);
     Assert.AreEqual(1, _instance.Questions.Count());
     Assert.AreEqual(30, _instance.RemainingQuestionTime.TotalSeconds);
 }
Exemplo n.º 2
0
    public void TestNextQuestionEmptyListClearsCurrent()
    {
        var instance = new ListOfSpeakersViewModel();

        instance.AddQuestion("Question");
        instance.NextQuestion();
        instance.NextQuestion();
        Assert.IsNull(instance.CurrentQuestion);
        Assert.IsFalse(instance.Questions.Any());
    }
Exemplo n.º 3
0
    public void TestNextQuestionsSetsCurrentQuestion()
    {
        var instance = new ListOfSpeakersViewModel();
        var question = instance.AddQuestion("Question");

        instance.NextQuestion();
        Assert.IsTrue(instance.CurrentQuestion == question);
    }
Exemplo n.º 4
0
    public void TestNextQuestionRemovesQuestionFromList()
    {
        var instance = new ListOfSpeakersViewModel();
        var question = instance.AddQuestion("Question");

        instance.NextQuestion();
        Assert.IsFalse(instance.Questions.Any());
    }
Exemplo n.º 5
0
    public void TestClearCurrentQuestionWhileQuestionActive()
    {
        var instance = new ListOfSpeakersViewModel();

        instance.AddQuestion("Question");
        instance.NextQuestion();
        instance.ResumeQuestion();
        instance.ClearCurrentQuestion();
        Assert.AreEqual(ESpeakerListStatus.Stopped, instance.Status);
    }
Exemplo n.º 6
0
    public void TestPauseWHileQUestionPausesQuestion()
    {
        var instance = new ListOfSpeakersViewModel();

        instance.AddQuestion("Question");
        instance.NextQuestion();
        instance.ResumeQuestion();
        Assert.AreEqual(ESpeakerListStatus.Question, instance.Status);
        instance.Pause();
        Assert.AreEqual(ESpeakerListStatus.QuestionPaused, instance.Status);
    }
Exemplo n.º 7
0
    public void TestNextSpeakerWhileActiveSpeakerPauses()
    {
        var instance = new ListOfSpeakersViewModel();

        instance.AddSpeaker("Speaker");
        instance.NextSpeaker();
        instance.ResumeSpeaker();
        instance.AddQuestion("New Question");
        instance.NextQuestion();
        Assert.AreEqual(ESpeakerListStatus.SpeakerPaused, instance.Status);
    }
Exemplo n.º 8
0
    public void TestResetQuestionTIme()
    {
        var instance = new ListOfSpeakersViewModel();

        instance.AddQuestion("Question 1");
        instance.NextQuestion();
        instance.ResumeQuestion();
        instance.AddQuestionSeconds(-10);
        Assert.AreEqual(20, instance.RemainingQuestionTime.TotalSeconds, 0.5);
        instance.ResetQuestionTime();
        Assert.AreEqual(30, instance.RemainingQuestionTime.TotalSeconds, 0.5);
    }
Exemplo n.º 9
0
    public void TestStartQuestionFromStopResetsTime()
    {
        var instance = new ListOfSpeakersViewModel();

        instance.QuestionTime = new TimeSpan(0, 0, 30);
        var question = instance.AddQuestion("Question");

        instance.NextQuestion();
        instance.ResumeQuestion();
        // 29 to have a little puffer but this should compute instant
        Assert.IsTrue(instance.RemainingQuestionTime.TotalSeconds >= 29);
    }
Exemplo n.º 10
0
    public void TestResumePausedQuestion()
    {
        var instance = new ListOfSpeakersViewModel();

        instance.QuestionTime = new TimeSpan(0, 0, 30);
        instance.AddQuestion("Speaker");
        instance.NextQuestion();
        instance.ResumeQuestion();
        instance.AddQuestionSeconds(-10);
        instance.Pause();
        Assert.AreEqual(20, instance.RemainingQuestionTime.TotalSeconds, 0.5);
        instance.ResumeQuestion();
        Assert.AreEqual(20, instance.RemainingQuestionTime.TotalSeconds, 0.5);
    }
Exemplo n.º 11
0
    public void TestBothHaveCurrentQuestionButNotTheSame()
    {
        var listOne = new ListOfSpeakersViewModel()
        {
            ListOfSpeakersId = "fixedId"
        };
        var listTwo = new ListOfSpeakersViewModel()
        {
            ListOfSpeakersId = "fixedId"
        };

        listOne.AddQuestion("Test");
        listOne.NextQuestion();
        listTwo.AddQuestion("Test 2");
        listTwo.NextQuestion();
        var result = listOne.CompareTo(listTwo);

        Assert.AreEqual(1, result);
    }
Exemplo n.º 12
0
    public void TestTwoHasCurrentQuestionOneDoesnt()
    {
        var listOne = new ListOfSpeakersViewModel()
        {
            ListOfSpeakersId = "fixedId"
        };
        var listTwo = new ListOfSpeakersViewModel()
        {
            ListOfSpeakersId = "fixedId"
        };

        listTwo.AddQuestion("Test");
        listTwo.NextQuestion();
        var result = listOne.CompareTo(listTwo);

        Assert.NotNull(listTwo.CurrentQuestion);
        Assert.IsNull(listOne.CurrentQuestion);
        Assert.AreEqual(1, result);
    }