Ejemplo n.º 1
0
        public void TestGetStatus2()
        {
            LyricsFetchManager lfm = new LyricsFetchManager();
            lfm.RegisterSource(new AlwaysFailLyricsSource());
            lfm.RegisterSource(new AlwaysSuccessLyricsSource());

            Assert.AreEqual(LyricsFetchStatus.NotFound, lfm.GetStatus(s1));
            Assert.AreEqual(LyricsFetchStatus.NotFound, lfm.GetStatus(s2));
            Assert.AreEqual(LyricsFetchStatus.NotFound, lfm.GetStatus(s3));

            lfm.Queue(s1);
            lfm.Queue(s2);
            lfm.Queue(s3);
            Assert.AreEqual(LyricsFetchStatus.Waiting, lfm.GetStatus(s1));
            Assert.AreEqual(LyricsFetchStatus.Waiting, lfm.GetStatus(s2));
            Assert.AreEqual(LyricsFetchStatus.Waiting, lfm.GetStatus(s3));

            lfm.Start();
            lfm.WaitUntilFinished();

            Assert.AreEqual(LyricsFetchStatus.NotFound, lfm.GetStatus(s1));
            Assert.AreEqual(LyricsFetchStatus.NotFound, lfm.GetStatus(s2));
            Assert.AreEqual(LyricsFetchStatus.NotFound, lfm.GetStatus(s3));
        }
Ejemplo n.º 2
0
        public void TestGetStatus()
        {
            LyricsFetchManager lfm = new LyricsFetchManager();

            Assert.AreEqual(LyricsFetchStatus.NotFound, lfm.GetStatus(s1));
            Assert.AreEqual(LyricsFetchStatus.NotFound, lfm.GetStatus(s2));

            lfm.Queue(s1);
            lfm.Queue(s2);
            Assert.AreEqual(LyricsFetchStatus.Waiting, lfm.GetStatus(s1));
            Assert.AreEqual(LyricsFetchStatus.Waiting, lfm.GetStatus(s2));

            lfm.CancelAll();
            Assert.AreEqual(LyricsFetchStatus.NotFound, lfm.GetStatus(s1));
            Assert.AreEqual(LyricsFetchStatus.NotFound, lfm.GetStatus(s2));
        }