public void ApplyEnhancements_DuplicateEnhancementRequestsMade_OnlyUniqueResultsAddedToIdentity( string filePath, TvReleaseIdentity identity, TvDbEnhancement tvDbEnhancement, SubDbFileHashEnhancement subDbFileHashEnhancement, IEpisodeSubtitleDownloader downloader, IEnhancementProvider enhancementProvider ) { var expectedEnhancements = new IEnhancement[] {tvDbEnhancement, subDbFileHashEnhancement}; var downloaders = new[] {downloader}; var enhancementRequests = new IEnhancementRequest[] { new EnhancementRequest<TvDbEnhancement>(), new EnhancementRequest<TvDbEnhancement>(), new EnhancementRequest<SubDbFileHashEnhancement>() }; A.CallTo(() => downloader.EnhancementRequests).Returns(enhancementRequests); A.CallTo( () => enhancementProvider.GetEnhancement(A<Type>.That.IsEqualTo(typeof (TvDbEnhancement)), filePath, identity)) .Returns(tvDbEnhancement); A.CallTo( () => enhancementProvider.GetEnhancement(A<Type>.That.IsEqualTo(typeof (SubDbFileHashEnhancement)), filePath, identity)) .Returns(subDbFileHashEnhancement); var sut = new EnhancementApplicator(downloaders, enhancementProvider); sut.ApplyEnhancements(filePath, identity); Assert.That(identity.Enhancements, Is.EquivalentTo(expectedEnhancements)); }
public void ApplyEnhancements_EnhancementRequestsMade_ResultsAddedToIdentity( string filePath, TvReleaseIdentity identity, IEnumerable<IEnhancementRequest> enhancementRequests, IEnhancement[] enhancements, IEpisodeSubtitleDownloader downloader, IEnhancementProvider enhancementProvider ) { var downloaders = new[] {downloader}; A.CallTo(() => downloader.EnhancementRequests).Returns(enhancementRequests); A.CallTo(() => enhancementProvider.GetEnhancement(A<Type>._, filePath, identity)) .ReturnsNextFromSequence(enhancements); var sut = new EnhancementApplicator(downloaders, enhancementProvider); sut.ApplyEnhancements(filePath, identity); Assert.That(identity.Enhancements, Is.EquivalentTo(enhancements)); }