public Task Save(string episodeFile, EpisodeMetadata metadata)
 {
     if (metadata.FileInformation == null)
     {
         metadata.FileInformation = _fileInformationService.GetVideoFileInformation(episodeFile);
     }
     return(_metadataRepository.Save(episodeFile, metadata));
 }
 public Task Save(string episodeFile, EpisodeMetadata metadata)
 {
     if (metadata.FileInformation == null)
     {
         metadata.FileInformation = _fileInformationService.GetVideoFileInformation(episodeFile);
     }
     return _metadataRepository.Save(episodeFile, metadata);
 }
        public async Task Update(string episodeFile, string serieId)
        {
            EpisodeNumber   episode  = TvShowHelper.FindEpisodeNumberFromFile(_fileSystemService, episodeFile);
            EpisodeMetadata metadata = await GetMetadata(episodeFile, serieId, episode);

            metadata.PlayCount       = 0;
            metadata.FileInformation = _fileInformationService.GetVideoFileInformation(episodeFile);
            await Save(episodeFile, metadata);
        }
예제 #4
0
        public void Save_Always_PersistMetadata()
        {
            // Arrange
            EpisodeMetadata metadata = new EpisodeMetadata();

            // Act
            _service.Save(_path, metadata);

            // Assert
            _metadataRepository.Received()
            .Save(_path, metadata);
        }
        public void Save_Always_PersistMetadata()
        {
            // Arrange
            EpisodeMetadata metadata = new EpisodeMetadata();

            // Act
            _service.Save(_path, metadata);

            // Assert
            _metadataRepository.Received()
                .Save(_path, metadata);
        }
        public async Task Get_Always_ReturnsMetadata()
        {
            // Arrange
            EpisodeMetadata expectedMetadata = new EpisodeMetadata();
            _metadataRepository.Get(_path)
                .Returns(Task.FromResult(expectedMetadata));

            // Act
            EpisodeMetadata metadata = await _service.Get(_path);

            // Assert
            Assert.Equal(expectedMetadata, metadata);
        }
예제 #7
0
        public async Task Get_Always_ReturnsMetadata()
        {
            // Arrange
            EpisodeMetadata expectedMetadata = new EpisodeMetadata();

            _metadataRepository.Get(_path)
            .Returns(Task.FromResult(expectedMetadata));

            // Act
            EpisodeMetadata metadata = await _service.Get(_path);

            // Assert
            Assert.Equal(expectedMetadata, metadata);
        }
예제 #8
0
        public async Task Update_EpisodeFromSeason3_ShouldSaveMetadata()
        {
            // Arrange
            const string    path     = @"C:\Folder\TV Shows\Game of Thrones\Specials\3x02.mkv";
            EpisodeMetadata metadata = CreateEpisodeMetadata(3, "Season 3");

            _metadataUpdater.GetEpisodeMetadata("123", 3, 2)
            .Returns(metadata.ToTask());

            _fileInformationService.GetVideoFileInformation(path)
            .Returns(CreateFileInformation());

            // Act
            await _service.Update(path, "123");

            // Assert
            _metadataRepository.Received()
            .Save(path, metadata).Async();
        }
 private bool AssertMetadataEqualsViewModel(EpisodeMetadata metadata)
 {
     Assert.Equal(metadata.AiredDate, _viewModel.AiredDate);
     Assert.Equal(metadata.Credits, _viewModel.Credits.Collection);
     Assert.Equal(metadata.Director, _viewModel.Directors.Collection);
     Assert.Equal(metadata.DisplayEpisode, _viewModel.DisplayEpisode);
     Assert.Equal(metadata.DisplaySeason, _viewModel.DisplaySeason);
     Assert.Equal(metadata.EpisodeBookmarks, _viewModel.EpisodeBookmarks);
     Assert.Equal(metadata.EpisodeNumber, _viewModel.EpisodeNumber.Value);
     Assert.Equal(metadata.ImageUrl, _viewModel.ImageUrl);
     Assert.Equal(metadata.LastPlayed, _viewModel.LastPlayed);
     Assert.Equal(metadata.PlayCount, _viewModel.PlayCount);
     Assert.Equal(metadata.Plot, _viewModel.Plot);
     Assert.Equal(metadata.Rating, _viewModel.Rating);
     Assert.Equal(metadata.SeasonNumber, _viewModel.SeasonNumber.Value);
     Assert.Equal(metadata.Title, _viewModel.Title.Value);
     return true;
 }