Beispiel #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);
            }
        }
        protected LiteDatabase CreateDatabase()
        {
            LiteDatabase ret = new LiteDatabase(this.dbpath);

            BmpCoffer.MigrateDatabase(ret);
            return(ret);
        }
Beispiel #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);
            }
        }
Beispiel #4
0
        protected override void OnStart()
        {
            BmpPigeonhole.Initialize(Globals.DataPath + @"\Configuration.json");

            // var view = (MainView)View;
            // LogManager.Initialize(new(view.Log));

            BmpCoffer.Initialize(Globals.DataPath + @"\MusicCatalog.db");

            BmpSeer.Instance.SetupFirewall("BardMusicPlayer");

            BmpSeer.Instance.Start();

            BmpGrunt.Instance.Start();
        }
Beispiel #5
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]);
            }
        }
Beispiel #6
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);
            }
        }
Beispiel #7
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);
            }
        }
Beispiel #8
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);
            }
        }
Beispiel #9
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]);
            }
        }
Beispiel #10
0
        private BmpCoffer CreateCofferManager()
        {
            string dbPath = this.GetDBPath();

            return(BmpCoffer.CreateInstance(dbPath));
        }