Beispiel #1
0
        public void GetNextSongShouldReturnNextItem()
        {
            // Arrange
            var playlist = new SimplePlaylist();
            var song01   = @"C:\music\song01.mp3";
            var song02   = @"C:\music\song02.mp3";

            playlist.Add(song01);
            playlist.Add(song02);
            string nextSongPath;

            // Act
            nextSongPath = playlist.GetNextSongPath();

            // Assert
            Assert.Equal(song02, nextSongPath);
        }
Beispiel #2
0
        public void CountWithPlaylistWithItemsShouldReturnPlaylistItemCount()
        {
            // Arrange
            var playlist = new SimplePlaylist();
            var song01   = @"C:\music\song01.mp3";
            var song02   = @"C:\music\song02.mp3";

            playlist.Add(song01);
            playlist.Add(song02);
            int count;

            // Act
            count = playlist.Count;

            // Assert
            Assert.Equal(2, count);
        }
Beispiel #3
0
        public void GetPreviousSongPathSecondCallWithTwoItemsShouldReturnStringEmpty()
        {
            // Arrange
            var playlist = new SimplePlaylist();

            playlist.Add(@"C:\music\song01.mp3");
            playlist.Add(@"C:\music\song02.mp3");
            playlist.GetNextSongPath();
            string previousSongPath;

            // Act
            playlist.GetPreviousSongPath();
            previousSongPath = playlist.GetPreviousSongPath();

            // Assert
            Assert.Equal(string.Empty, previousSongPath);
        }
Beispiel #4
0
        public void GetPreviousSongPathWithMoreThanOneItemShouldReturnPreviousItem()
        {
            // Arrange
            var playlist = new SimplePlaylist();
            var song01   = @"C:\music\song01.mp3";

            playlist.Add(song01);
            playlist.Add(@"C:\music\song02.mp3");
            playlist.GetNextSongPath();
            string previousSongPath;

            // Act
            previousSongPath = playlist.GetPreviousSongPath();

            // Assert
            Assert.Equal(song01, previousSongPath);
        }
Beispiel #5
0
        public void AddWithEmptyShouldThrowArgumentNullException()
        {
            // Arrange
            var    playlist = new SimplePlaylist();
            string item     = string.Empty;

            // Act & Assert
            Assert.Throws <ArgumentNullException>(() => playlist.Add(item));
        }
Beispiel #6
0
        public void ClearWithItemsShouldClearPlaylist()
        {
            // Arrange
            var playlist = new SimplePlaylist();
            var song01   = @"C:\music\song01.mp3";
            var song02   = @"C:\music\song02.mp3";

            playlist.Add(song01);
            playlist.Add(song02);
            string currentSongPath;

            // Act
            playlist.Clear();
            currentSongPath = playlist.GetCurrentSongPath();

            // Assert
            Assert.Equal(string.Empty, currentSongPath);
        }
Beispiel #7
0
        public void AddArrayWithEmptyItemShouldThrowArgumentException()
        {
            // Arrange
            var playlist = new SimplePlaylist();

            string[] items = { "file01.mp3", string.Empty, "file03.mp3" };

            // Act & Assert
            Assert.Throws <ArgumentException>(() => playlist.Add(items));
        }
Beispiel #8
0
        public void AddArrayWithNullShouldThrowArgumentNullException()
        {
            // Arrange
            var playlist = new SimplePlaylist();

            string[] items = null;

            // Act & Assert
            Assert.Throws <ArgumentNullException>(() => playlist.Add(items));
        }
Beispiel #9
0
        public void AddWithArrayShouldAddElementsToCollection()
        {
            // Arrange
            var playlist = new SimplePlaylist();
            var items    = new [] { "file01.mp3", "file02.mp3", "file03.mp3" };

            // Act
            playlist.Add(items);

            // Assert
            Assert.Equal(3, playlist.Count);
        }
Beispiel #10
0
        public void GetPreviousSongPathWithOneItemShouldReturnStringEmpty()
        {
            // Arrange
            var playlist = new SimplePlaylist();

            playlist.Add(@"C:\music\song.mp3");
            string previousSongPath;

            // Act
            previousSongPath = playlist.GetPreviousSongPath();

            // Assert
            Assert.Equal(string.Empty, previousSongPath);
        }
Beispiel #11
0
        public void GetCurrentSongWithOneItemShouldReturnItem()
        {
            // Arrange
            var playlist = new SimplePlaylist();
            var song01   = @"C:\music\song01.mp3";

            playlist.Add(song01);
            string currentSongPath;

            // Act
            currentSongPath = playlist.GetCurrentSongPath();

            // Assert
            Assert.Equal(song01, currentSongPath);
        }