Exemple #1
0
 public void TestNextSpeaker()
 {
     _instance.NextSpeaker();
     Assert.AreEqual(1, _instance.Speakers.Count());
     Assert.NotNull(_instance.CurrentSpeaker);
     Assert.AreEqual("First Speaker", _instance.CurrentSpeaker.Name);
 }
Exemple #2
0
    public void TestNextSpeakerEmptyListCearsCurrent()
    {
        var instance = new ListOfSpeakersViewModel();

        instance.AddSpeaker("Speaker");
        instance.NextSpeaker();
        instance.NextSpeaker();
        Assert.IsNull(instance.CurrentSpeaker);
        Assert.IsFalse(instance.Speakers.Any());
    }
Exemple #3
0
    public void TestResumeSpeakerAsStartResetsTime()
    {
        var instance = new ListOfSpeakersViewModel();

        instance.SpeakerTime = new TimeSpan(0, 0, 30);
        instance.AddSpeaker("Speaker One");
        instance.NextSpeaker();
        instance.ResumeSpeaker();
        instance.StartSpeakerTime = DateTime.Now.ToUniversalTime().AddSeconds(-10);   // Faking that the last speaker already removed 10 secs
        Assert.AreEqual(20, Math.Round(instance.RemainingSpeakerTime.TotalSeconds));
        instance.AddSpeaker("Next Speaker");
        instance.NextSpeaker();
        instance.ResumeSpeaker();
        Assert.AreEqual(30, Math.Round(instance.RemainingSpeakerTime.TotalSeconds));
    }
Exemple #4
0
    public void TestNextSpeakerSetsCurrentSpeaker()
    {
        var instance = new ListOfSpeakersViewModel();
        var speaker  = instance.AddSpeaker("Speaker 1");

        instance.NextSpeaker();
        Assert.AreEqual(speaker, instance.CurrentSpeaker);
    }
Exemple #5
0
    public void TestNextSpeakerRemovesFromList()
    {
        var instance = new ListOfSpeakersViewModel();
        var speaker  = instance.AddSpeaker("Speaker 1");

        instance.NextSpeaker();
        Assert.IsFalse(instance.Speakers.Any());
    }
Exemple #6
0
    public void TestClearCurrentSpeakerWhileSpeaking()
    {
        var instance = new ListOfSpeakersViewModel();

        instance.SpeakerTime = new TimeSpan(0, 0, 30);
        instance.AddSpeaker("Speaker");
        instance.NextSpeaker();
        instance.ResumeSpeaker();
        instance.ClearCurrentSpeaker();
        Assert.AreEqual(ESpeakerListStatus.Stopped, instance.Status);
    }
Exemple #7
0
    public void TestPauseWhileAnswerPausesAnswer()
    {
        var instance = new ListOfSpeakersViewModel();

        instance.AddSpeaker("Speaker");
        instance.NextSpeaker();
        instance.StartAnswer();
        Assert.AreEqual(ESpeakerListStatus.Answer, instance.Status);
        instance.Pause();
        Assert.AreEqual(ESpeakerListStatus.AnswerPaused, instance.Status);
    }
Exemple #8
0
    public void TestPauseWhileSpeakingPausesSpeaker()
    {
        var instance = new ListOfSpeakersViewModel();

        instance.AddSpeaker("Speaker");
        instance.NextSpeaker();
        instance.ResumeSpeaker();
        Assert.AreEqual(ESpeakerListStatus.Speaking, instance.Status);
        instance.Pause();
        Assert.AreEqual(ESpeakerListStatus.SpeakerPaused, instance.Status);
    }
Exemple #9
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);
    }
Exemple #10
0
    public void TestAnswerSetsTimeToQuestionTime()
    {
        var instance = new ListOfSpeakersViewModel();

        instance.QuestionTime = new TimeSpan(0, 0, 30);
        instance.AddSpeaker("Speaker");
        instance.NextSpeaker();
        instance.StartAnswer();
        Assert.AreEqual(30, instance.RemainingSpeakerTime.TotalSeconds, 1);
        //Assert.IsTrue(instance.RemainingSpeakerTime.TotalSeconds >= 29 && instance.RemainingSpeakerTime.TotalSeconds <= 30);
    }
Exemple #11
0
    public void TestNextSpeakerSettingTime()
    {
        var instance = new ListOfSpeakersViewModel();

        instance.SpeakerTime = new TimeSpan(0, 0, 0, 30);
        var speaker = instance.AddSpeaker("Speaker 1");

        instance.NextSpeaker();
        instance.ResumeSpeaker();
        Assert.AreEqual(30, instance.RemainingSpeakerTime.TotalSeconds, 1);
        //Assert.IsTrue(instance.RemainingSpeakerTime.TotalSeconds >= 29 && instance.RemainingSpeakerTime.TotalSeconds < 31);
    }
Exemple #12
0
    public void TestResetSpeakerTime()
    {
        var instance = new ListOfSpeakersViewModel();

        instance.SpeakerTime = new TimeSpan(0, 0, 30);
        instance.AddSpeaker("Speaker 1");
        instance.NextSpeaker();
        instance.ResumeSpeaker();
        instance.AddSpeakerSeconds(-10);
        Assert.IsTrue(instance.RemainingSpeakerTime.TotalSeconds <= 20);
        instance.ResetSpeakerTime();
        Assert.AreEqual(30, instance.RemainingSpeakerTime.TotalSeconds, 0.5);
    }
Exemple #13
0
    public void TestResumePausedAnswer()
    {
        var instance = new ListOfSpeakersViewModel();

        instance.QuestionTime = new TimeSpan(0, 0, 30);
        instance.AddSpeaker("Speaker");
        instance.NextSpeaker();
        instance.StartAnswer();
        instance.AddSpeakerSeconds(-10);
        instance.Pause();
        Assert.AreEqual(20, instance.RemainingSpeakerTime.TotalSeconds, 0.5);
        instance.ResumeSpeaker();
        Assert.AreEqual(20, instance.RemainingSpeakerTime.TotalSeconds, 0.5);
    }
Exemple #14
0
    public void TestListOneHasCurrentSpeakerListTwoDoesnt()
    {
        var listOne = new ListOfSpeakersViewModel()
        {
            ListOfSpeakersId = "fixedId"
        };
        var listTwo = new ListOfSpeakersViewModel()
        {
            ListOfSpeakersId = "fixedId"
        };

        listOne.AddSpeaker("Test");
        listOne.NextSpeaker();
        var result = listOne.CompareTo(listTwo);

        Assert.AreEqual(1, result);
    }
Exemple #15
0
    public void TestBothHaveASpeakerButNotTheSame()
    {
        var listOne = new ListOfSpeakersViewModel()
        {
            ListOfSpeakersId = "fixedId"
        };
        var listTwo = new ListOfSpeakersViewModel()
        {
            ListOfSpeakersId = "fixedId"
        };

        listOne.AddSpeaker("Test");
        listOne.NextSpeaker();

        listTwo.AddSpeaker("Test");
        listTwo.NextSpeaker();

        var result = listOne.CompareTo(listTwo);

        Assert.AreEqual(1, result);
    }