public void UseAsyncDownloader() { ReleaseChecker releaseChecker = new ReleaseChecker(); releaseChecker.UseAsyncDownloader <AsyncDownloader>(); Assert.IsInstanceOf <AsyncDownloader>(releaseChecker.AsyncDownloader); IAsyncDownloader downloader = Substitute.For <IAsyncDownloader>(); releaseChecker.UseAsyncDownloader(downloader); Assert.AreSame(downloader, releaseChecker.AsyncDownloader); }
public void CheckEmptyArray() { string returnJson = "[]"; ReleaseChecker releaseChecker = new ReleaseChecker(); IAsyncDownloader downloader = Substitute.For <IAsyncDownloader>(); downloader.DownloadAsync(null, 0).ReturnsForAnyArgs(Task.FromResult(returnJson)); releaseChecker.UseAsyncDownloader(downloader); Release result = releaseChecker.Check().Result; Assert.AreEqual(null, result); }
public void CheckInvalidVersion() { string versionString = "v1.3.5.2150000000"; string url = "http://url.to/some?download#location"; string returnJson = string.Format(@"[ {{ ""html_url"": ""{0}"", ""tag_name"": ""{1}"" }} ]", url, versionString); ReleaseChecker releaseChecker = new ReleaseChecker(); IAsyncDownloader downloader = Substitute.For <IAsyncDownloader>(); downloader.DownloadAsync(null, 0).ReturnsForAnyArgs(Task.FromResult(returnJson)); releaseChecker.UseAsyncDownloader(downloader); Release result = releaseChecker.Check().Result; Assert.AreEqual(null, result); }