BB.UI.Web.MVC.Tests.Controllers.PlaylistControllerTest.TestMoveTrackToHistory C# (CSharp) Method

TestMoveTrackToHistory() private method

private TestMoveTrackToHistory ( ) : void
return void
        public void TestMoveTrackToHistory()
        {
            var playlistResult = controller.View("ABC123456") as ViewResult;
            var playlist = playlistResult?.Model as Playlist;
            var playlistTracks = playlist?.PlaylistTracks;
            var aantalTracks = playlistTracks?.Count ?? 0; // get the amount of tracks in the playlist
            
            var moveTrackResult = controller.MoveTrackToHistory(1) as HttpStatusCodeResult;
            Assert.IsNotNull(moveTrackResult);
            Assert.AreEqual(200, moveTrackResult.StatusCode);

            playlistResult = controller.View("ABC123456") as ViewResult;
            Assert.IsNotNull(playlistResult);

            playlist = playlistResult.Model as Playlist;
            Assert.IsNotNull(playlist);
            Assert.AreEqual(aantalTracks - 1, playlist.PlaylistTracks.Count); // after moving the track to the history, make sure it is one less track compared to in the beginning
        }