protected override void When()
 {
     ThrownException = null;
     try
     {
         Playlist = PlaylistFactory.CreatePlaylist(PlayListFormat, PlayllistFilename);
     }
     catch (Exception e)
     {
         ThrownException = e;
     }
 }
        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);
        }