public void CreateItem_NoVideoExists_VideoAndItemCreated() { PlaylistItem playlistItem = Helpers.CreateItemInPlaylist(Playlist); // Ensure that the PlaylistItem was created. PlaylistItem itemFromDatabase = PlaylistItemManager.Get(playlistItem.Id); Assert.NotNull(itemFromDatabase); // Should have a sequence number after saving for sure. Assert.GreaterOrEqual(itemFromDatabase.Sequence, 0); // Pointers should be self-referential with only one item in the Playlist. //Assert.AreEqual(itemFromDatabase.NextItem, itemFromDatabase); //Assert.AreEqual(itemFromDatabase.PreviousItem, itemFromDatabase); }
public void Patch(Guid id, PlaylistItemDto playlistItemDto) { using (ITransaction transaction = Session.BeginTransaction()) { PlaylistItem playlistItem = PlaylistItemManager.Get(id); playlistItemDto.SetPatchableProperties(playlistItem); PlaylistItemManager.Update(playlistItem); transaction.Commit(); } }
public void PatchPlaylistItem_SequenceProvided_SequenceModified() { PlaylistItemDto playlistItemDto = Helpers.CreatePlaylistItemDto(); var createdPlaylistItemDto = PlaylistItemController.Create(playlistItemDto); const double newSequence = 5; PlaylistItemDto patchedPlaylistItemDto = new PlaylistItemDto { Sequence = newSequence }; PlaylistItem playlistItem = PlaylistItemManager.Get(createdPlaylistItemDto.Id); PlaylistItemController.Patch(playlistItem.Id, patchedPlaylistItemDto); Assert.AreEqual(playlistItem.Sequence, newSequence); }