public void FirstEpisodeMatchingSearchReturnsTorrent() { var xml = string.Empty; using ( var stream = Assembly.GetExecutingAssembly() .GetManifestResourceStream("TvTamer.Core.UnitTests.XmlSamples.KatEpisodeSearchResults.xml")) { using (var reader = new StreamReader(stream)) { xml = reader.ReadToEnd(); } } var document = new XmlDocument(); document.LoadXml(xml); var analyticService = new Mock<IAnalyticsService>(); var webRequestor = new Mock<IWebClient>(); webRequestor.Setup(wr => wr.GetXml(It.IsAny<string>(), It.IsAny<string>())).Returns(document); var nullSearchProvider = new NullSearchProvider(); var katSearchProvider = new KickassSearchProvider(nullSearchProvider, webRequestor.Object, analyticService.Object); var result = katSearchProvider.GetTorrent("some valid search goes here"); Assert.That(result, Is.Not.Null); Assert.That(result.Name, Is.Not.Null.Or.Empty); Assert.That(result.MagnetUrl, Is.Not.Null.Or.Empty); }
public void KickAssSearchProvider_Returns_First_Value() { var analyticService = new Mock<IAnalyticsService>(); var searchProvider = new KickassSearchProvider(new NullSearchProvider(), new WebClient(analyticService.Object), analyticService.Object); var result = searchProvider.GetTorrent("the big bang theory s01e01 720"); Assert.That(result, Is.Not.Null); }
public void NoEpisodeFoundReturnsNull() { var webRequestor = new Mock<IWebClient>(); webRequestor.Setup(wr => wr.GetXml(It.IsAny<string>(), null)).Returns(new XmlDocument()); var analyticService = new Mock<IAnalyticsService>(); var nullSearchProvider = new NullSearchProvider(); var katSearchProvider = new KickassSearchProvider(nullSearchProvider, webRequestor.Object, analyticService.Object); var tpbSearchProvider = new ThePirateBaySearchProvider(katSearchProvider); var result = tpbSearchProvider.GetTorrent("some valid search goes here"); Assert.That(result, Is.Null); }