示例#1
0
        public void TestPlaylistBasics()
        {
            BmpSong song = LoadTestSong();

            Assert.IsNull(song.Id);

            using (BmpCoffer test = this.CreateCofferManager())
            {
                test.SaveSong(song);
                Assert.IsNotNull(song.Id);

                IPlaylist playlist = test.CreatePlaylist(PLAYLIST_NAME);
                Assert.IsNotNull(playlist);
                Assert.IsTrue(playlist is BmpPlaylistDecorator);
                Assert.AreEqual(PLAYLIST_NAME, playlist.GetName());

                // Internal things...
                BmpPlaylist backingData = ((BmpPlaylistDecorator)playlist).GetBmpPlaylist();
                Assert.IsNull(backingData.Id);

                playlist.Add(song);

                test.SavePlaylist(playlist);
                Assert.IsNotNull(backingData.Id);

                IPlaylist result = test.GetPlaylist(PLAYLIST_NAME);
                Assert.IsNotNull(result);
                Assert.AreEqual(backingData.Id, ((BmpPlaylistDecorator)playlist).GetBmpPlaylist().Id);
            }
        }
示例#2
0
        public void TestDuplicateSong()
        {
            BmpSong songA = LoadTestSong();

            Assert.IsNull(songA.Id);

            BmpSong songB = LoadTestSong();

            Assert.IsNull(songB.Id);

            using (BmpCoffer test = this.CreateCofferManager())
            {
                test.SaveSong(songA);
                Assert.IsNotNull(songA.Id);

                test.SaveSong(songB);
            }
        }
示例#3
0
        public void TestSongBasics()
        {
            BmpSong song = LoadTestSong();

            Assert.IsNull(song.Id);

            using (BmpCoffer test = this.CreateCofferManager())
            {
                test.SaveSong(song);
                Assert.IsNotNull(song.Id);

                BmpSong resultTitle = test.GetSong(song.Title);
                Assert.AreEqual(song.Id, resultTitle.Id);
            }
        }
示例#4
0
        public void TestSongListing()
        {
            BmpSong song = LoadTestSong();

            Assert.IsNull(song.Id);

            using (BmpCoffer test = this.CreateCofferManager())
            {
                test.SaveSong(song);
                Assert.IsNotNull(song.Id);

                IList <string> resultAll = test.GetSongTitles();
                Assert.AreEqual(1, resultAll.Count);
                Assert.AreEqual(song.Title, resultAll[0]);
            }
        }
示例#5
0
        public void TestDuplicatePlaylist()
        {
            BmpSong song = LoadTestSong();

            Assert.IsNull(song.Id);

            using (BmpCoffer test = this.CreateCofferManager())
            {
                test.SaveSong(song);
                Assert.IsNotNull(song.Id);

                IPlaylist playlistA = test.CreatePlaylist(PLAYLIST_NAME);
                Assert.IsNotNull(playlistA);

                IPlaylist playlistB = test.CreatePlaylist(PLAYLIST_NAME);
                Assert.IsNotNull(playlistB);

                test.SavePlaylist(playlistA);
                test.SavePlaylist(playlistB);
            }
        }
示例#6
0
        public void TestPlaylistFromTag()
        {
            BmpSong song = LoadTestSong();

            Assert.IsNull(song.Id);

            song.Tags.Add(TEST_SONG_TAG_A);
            song.Tags.Add(TEST_SONG_TAG_B);

            using (BmpCoffer test = this.CreateCofferManager())
            {
                test.SaveSong(song);
                Assert.IsNotNull(song.Id);

                IPlaylist tagPlaylist = test.CreatePlaylistFromTag(TEST_SONG_TAG_A);
                Assert.IsNotNull(tagPlaylist);

                List <BmpSong> allTags = new List <BmpSong>();
                foreach (BmpSong entry in tagPlaylist)
                {
                    allTags.Add(entry);
                }

                Assert.AreEqual(1, allTags.Count);
                Assert.AreEqual(song.Id, allTags[0].Id);

                tagPlaylist = test.CreatePlaylistFromTag(TEST_SONG_TAG_B);
                Assert.IsNotNull(tagPlaylist);

                allTags.Clear();
                foreach (BmpSong entry in tagPlaylist)
                {
                    allTags.Add(entry);
                }

                Assert.AreEqual(1, allTags.Count);
                Assert.AreEqual(song.Id, allTags[0].Id);
            }
        }
示例#7
0
        public void TestPlaylistListing()
        {
            BmpSong song = LoadTestSong();

            Assert.IsNull(song.Id);

            using (BmpCoffer test = this.CreateCofferManager())
            {
                test.SaveSong(song);
                Assert.IsNotNull(song.Id);

                IPlaylist playlist = test.CreatePlaylist(PLAYLIST_NAME);
                Assert.IsNotNull(playlist);

                playlist.Add(song);

                test.SavePlaylist(playlist);

                IList <string> names = test.GetPlaylistNames();
                Assert.AreEqual(1, names.Count);
                Assert.AreEqual(playlist.GetName(), names[0]);
            }
        }