Exemplo n.º 1
0
    public void TestAddedSpeakerKeepsOrder()
    {
        var instance = new ListOfSpeakersViewModel();

        instance.AddSpeaker("Speaker 1");
        instance.AddSpeaker("Speaker 2");
        Assert.AreEqual(0, instance.Speakers.ElementAt(0).OrdnerIndex);
        Assert.AreEqual(1, instance.Speakers.ElementAt(1).OrdnerIndex);
        Assert.AreEqual("Speaker 1", instance.Speakers.ElementAt(0).Name);
        Assert.AreEqual("Speaker 2", instance.Speakers.ElementAt(1).Name);
    }
Exemplo n.º 2
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));
    }
Exemplo n.º 3
0
    public void TestNextSpeakerSetsCurrentSpeaker()
    {
        var instance = new ListOfSpeakersViewModel();
        var speaker  = instance.AddSpeaker("Speaker 1");

        instance.NextSpeaker();
        Assert.AreEqual(speaker, instance.CurrentSpeaker);
    }
Exemplo n.º 4
0
    public void TestNextSpeakerRemovesFromList()
    {
        var instance = new ListOfSpeakersViewModel();
        var speaker  = instance.AddSpeaker("Speaker 1");

        instance.NextSpeaker();
        Assert.IsFalse(instance.Speakers.Any());
    }
Exemplo n.º 5
0
    public void TestAddSpeaker()
    {
        var instance = new ListOfSpeakersViewModel();
        var speaker  = instance.AddSpeaker("Speaker 1");

        Assert.NotNull(speaker);
        Assert.IsTrue(instance.Speakers.Any(n => n.Name == "Speaker 1"));
    }
Exemplo n.º 6
0
    public void TestNextSpeakerEmptyListCearsCurrent()
    {
        var instance = new ListOfSpeakersViewModel();

        instance.AddSpeaker("Speaker");
        instance.NextSpeaker();
        instance.NextSpeaker();
        Assert.IsNull(instance.CurrentSpeaker);
        Assert.IsFalse(instance.Speakers.Any());
    }
Exemplo n.º 7
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);
    }
Exemplo n.º 8
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);
    }
Exemplo n.º 9
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);
    }
Exemplo n.º 10
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.º 11
0
    public void TestMoreSpeakersReturnsFalse()
    {
        var instanceOne = new ListOfSpeakersViewModel();
        var instanceTwo = new ListOfSpeakersViewModel();

        instanceTwo.ListOfSpeakersId = instanceOne.ListOfSpeakersId;
        instanceOne.AddSpeaker("Speaker 1");
        var result = instanceOne.CompareTo(instanceTwo);

        Assert.AreNotEqual(0, result);
    }
Exemplo n.º 12
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);
    }
Exemplo n.º 13
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);
    }
Exemplo n.º 14
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);
    }
Exemplo n.º 15
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);
    }
Exemplo n.º 16
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);
    }
Exemplo n.º 17
0
    public void SpeakersDiffer()
    {
        var listOne = new ListOfSpeakersViewModel()
        {
            ListOfSpeakersId = "fixedId",
        };
        var listTwo = new ListOfSpeakersViewModel()
        {
            ListOfSpeakersId = "fixedId",
        };

        listOne.AddSpeaker("Speaker");
        listTwo.AddSpeaker("Speaker2");

        var result = listOne.CompareTo(listTwo);

        Assert.AreEqual(1, result);
    }
Exemplo n.º 18
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);
    }