コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }