public IPlaylistItems Create(string filepath)
        {
            IPlaylistItems playlistItems = null;

            if (string.IsNullOrEmpty(filepath))
            {
                return(null);
            }

            var extension = Path.GetExtension(filepath);

            switch (extension)
            {
            case ".mp3":
                playlistItems = new Mp3Item(filepath);
                break;

            //case ".jpg":
            //    playlistItems = new PictureItem(filepath); // cuando no es conocido el formato va a el default
            //    break;

            default:
                playlistItems = null;
                break;
            }

            return(playlistItems);
        }
Пример #2
0
        private static ListViewItem createListViewItem(IPlaylistItems item)
        {
            ListViewItem lvi = new ListViewItem();

            lvi.Text = item.ToString();
            lvi.Tag  = item;
            return(lvi);
        }
Пример #3
0
            public void GetTitle_FilePathEmpty()
            {
                //todo test debe tener esta estructura arrange, act, assert
                //arrange
                // se usa @para que interprete el \ o se hace con doble
                _fixture = new Mp3Item(@"C:\Users\user\Documents\TestMediaFiles\001 - Bruno Mars - Grenade.mp3");

                //act
                var title = _fixture.Title;

                //assert
                Assert.That(title, Is.EqualTo("--[File not found]--"));
            }
Пример #4
0
            public void GetTitle_FilePathIsNull()
            {
                //todo test debe tener esta estructura arrange, act, assert
                //arrange
                // se usa @para que interprete el \ o se hace con doble
                _fixture = new Mp3Item(String.Empty);

                //act
                var title = _fixture.Title;

                //assert
                Assert.That(title, Is.EqualTo("--[File not found]--"));
            }
Пример #5
0
            public void GetThumbnail()
            {
                //todo test debe tener esta estructura arrange, act, assert
                //arrange
                // se usa @para que interprete el \ o se hace con doble
                var demoMp3Path = @"C:\Users\user\Documents\TestMediaFiles\001 - Bruno Mars - Grenade.mp3";

                _fixture = new Mp3Item(demoMp3Path);
                //act
                var thumbnail = _fixture.Thumbnail;

                //assert
                Assert.That(thumbnail, Is.Not.Null);
            }
Пример #6
0
            public void GetPath()
            {
                //todo test debe tener esta estructura arrange, act, assert
                //arrange
                // se usa @para que interprete el \ o se hace con doble
                var demoMp3Path = @"C:\Users\user\Documents\TestMediaFiles\001 - Bruno Mars - Grenade.mp3";

                _fixture = new Mp3Item(demoMp3Path);
                //act
                var path = _fixture.Path;

                //assert
                Assert.That(path, Is.EqualTo(demoMp3Path));
            }
Пример #7
0
 public void Remove(IPlaylistItems item)
 {
     _itemList.Remove(item);
 }
Пример #8
0
 public void Add(IPlaylistItems item)
 {
     _itemList.Add(item);
     //_itemList.Add(newItem);
 }
Пример #9
0
 public void TestInit()
 {
     _fixture = new Mp3Item(@"C:\Users\user\Documents\TestMediaFiles\001 - Bruno Mars - Grenade.mp3");
 }