コード例 #1
0
    public void TestResumePausedSpeaker()
    {
        var instance = new ListOfSpeakersViewModel();

        instance.SpeakerTime = new TimeSpan(0, 0, 30);
        instance.AddSpeaker("Speaker");
        instance.NextSpeaker();
        instance.ResumeSpeaker();
        instance.AddSpeakerSeconds(-10);
        instance.Pause();
        Assert.AreEqual(20, instance.RemainingSpeakerTime.TotalSeconds, 0.5);
        instance.ResumeSpeaker();
        Assert.AreEqual(20, instance.RemainingSpeakerTime.TotalSeconds, 0.5);
    }
コード例 #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));
    }
コード例 #3
0
    public void TestStartSpeakerWithoutCurrentStopsList()
    {
        var instance = new ListOfSpeakersViewModel();

        instance.ResumeSpeaker();
        Assert.AreEqual(ESpeakerListStatus.Stopped, instance.Status);
    }
コード例 #4
0
    public async Task TestStartFirstSpeaker()
    {
        _instance.ResumeSpeaker();
        Assert.IsTrue(_instance.Status == ESpeakerListStatus.Speaking);
        await Task.Delay(3000);

        Assert.AreEqual(177, (int)Math.Round(_instance.RemainingSpeakerTime.TotalSeconds));
    }
コード例 #5
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);
    }
コード例 #6
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);
    }
コード例 #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);
    }
コード例 #8
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);
    }