protected override void When()
 {
     ThrownException = null;
     try
     {
         Playlist = PlaylistFactory.CreatePlaylist(PlayListFormat, PlayllistFilename);
     }
     catch (Exception e)
     {
         ThrownException = e;
     }
 }
Exemple #2
0
        public void FilterPlaylistLoad()
        {
            var lib    = CreateLibrary();
            var set    = new KoPlayer.Settings();
            var loaded = PlaylistFactory.MakePlaylist(@"Playlists/fpl 3.pl", lib, set) as FilterPlaylist;

            Assert.AreEqual(0, loaded.NumSongs);

            loaded.Filters.RemoveAt(2);

            loaded.FilterLibrary();
            Assert.AreEqual(2, loaded.NumSongs);
        }
 public void PlaylistFactoryConstructMissingNameTest()
 {
     var target = new PlaylistFactory();
     var raw = XElement.Parse(@"
     <playlist id=""1234"">
     <owner>Karl Vollmer</owner>
     <items>50</items>
     <tag id=""2481"" count=""2"">Rock &amp; Roll</tag>
     <tag id=""2482"" count=""2"">Rock</tag>
     <tag id=""2483"" count=""1"">Roll</tag>
     <type>Public</type>
     </playlist>");
     var actual = target.Construct(raw);
     Assert.Fail();
 }
 public void PlaylistFactoryConstructMissingOwnerTest()
 {
     var target = new PlaylistFactory();
     var raw = XElement.Parse(@"
     <playlist id=""1234"">
     <name>The Good Stuff</name>
     <items>50</items>
     <tag id=""2481"" count=""2"">Rock &amp; Roll</tag>
     <tag id=""2482"" count=""2"">Rock</tag>
     <tag id=""2483"" count=""1"">Roll</tag>
     <type>Public</type>
     </playlist>");
     var actual = target.Construct(raw);
     Assert.That(actual.Id, Is.EqualTo(1234));
     Assert.That(actual.Name, Is.EqualTo("The Good Stuff"));
     Assert.That(actual.SongCount, Is.EqualTo(50));
     Assert.That(actual.Tags.Count, Is.EqualTo(3));
 }
 public void PlaylistFactoryConstructBadXmlTest()
 {
     var target = new PlaylistFactory();
     var raw = XElement.Parse(@"
     <albums>
     <name>Back in Black</name>
     <artist id=""129348"">AC/DC</artist>
     <year>1984</year>
     <tracks>12</tracks>
     <disk>1</disk>
     <tag id=""2482"" count=""1"">Rock &amp; Roll</tag>
     <tag id=""2482"" count=""1"">Rock</tag>
     <tag id=""2483"" count=""1"">Roll</tag>
     <art>http://localhost/image.php?id=129348</art>
     <preciserating>3</preciserating>
     <rating>2.9</rating>
     </albums>");
     var actual = target.Construct(raw);
     Assert.Fail();
 }
 protected override void GivenThat()
 {
     base.GivenThat();
     PlaylistFactory   = new PlaylistFactory();
     PlayllistFilename = "myplaylist.ext";
 }
 public void PlaylistFactoryConstructMissingTagsTest()
 {
     var target = new PlaylistFactory();
     var raw = XElement.Parse(@"
     <playlist id=""1234"">
     <name>The Good Stuff</name>
     <owner>Karl Vollmer</owner>
     <items>50</items>
     <type>Public</type>
     </playlist>");
     var actual = target.Construct(raw);
     Assert.That(actual.Id, Is.EqualTo(1234));
     Assert.That(actual.Name, Is.EqualTo("The Good Stuff"));
     Assert.That(actual.SongCount, Is.EqualTo(50));
     Assert.That(actual.Tags.Count, Is.EqualTo(0));
 }
        public void TestCrudPlaylists()
        {
            IVideoItem vi = VideoItemFactory.CreateVideoItem(SiteType.YouTube);

            FillTestVideoItem(vi, SyncState.Added);

            IVideoItem vi2 = VideoItemFactory.CreateVideoItem(SiteType.YouTube);

            FillTestVideoItem(vi2, SyncState.Deleted);
            vi2.ID = "vi2";

            ICred cred = CredFactory.CreateCred();

            FillTestCred(cred);

            IChannel ch = ChannelFactory.CreateChannel(SiteType.YouTube);

            FillTestChannel(ch, vi, vi2);

            IPlaylist pl = PlaylistFactory.CreatePlaylist(SiteType.YouTube);

            FillTestPl(pl, ch);

            // DeleteCredAsync
            Task t = db.DeleteCredAsync(cred.SiteAdress);

            Assert.IsTrue(!t.IsFaulted);

            // InsertCredAsync
            t = db.InsertCredAsync(cred);
            Assert.IsTrue(!t.IsFaulted);

            // DeleteChannelAsync
            t = db.DeleteChannelAsync(ch.ID);
            Assert.IsTrue(!t.IsFaulted);

            // InsertChannelItemsAsync
            t = db.InsertChannelItemsAsync(ch);
            Assert.IsTrue(!t.IsFaulted);

            // DeletePlaylistAsync
            t = db.DeletePlaylistAsync(pl.ID);
            Assert.IsTrue(!t.IsFaulted);

            // InsertPlaylistAsync
            t = db.InsertPlaylistAsync(pl);
            Assert.IsTrue(!t.IsFaulted);

            // GetPlaylistAsync
            t = db.GetPlaylistAsync(pl.ID);
            Assert.IsTrue(!t.IsFaulted);

            // GetChannelPlaylistAsync
            t = db.GetChannelPlaylistAsync(ch.ID);
            Assert.IsTrue(!t.IsFaulted);

            // UpdatePlaylistAsync
            t = db.UpdatePlaylistAsync(pl.ID, vi.ID, ch.ID);
            Assert.IsTrue(!t.IsFaulted);

            // GetPlaylistItemsAsync
            t = db.GetPlaylistItemsAsync(pl.ID, ch.ID);
            Assert.IsTrue(!t.IsFaulted);

            // DeletePlaylistAsync
            t = db.DeletePlaylistAsync(pl.ID);
            Assert.IsTrue(!t.IsFaulted);

            // DeleteChannelAsync
            t = db.DeleteChannelAsync(ch.ID);
            Assert.IsTrue(!t.IsFaulted);

            // DeleteCredAsync
            t = db.DeleteCredAsync(cred.SiteAdress);
            Assert.IsTrue(!t.IsFaulted);
        }