Inheritance: IMultiMirrorFileDownloader
コード例 #1
0
        public void CanDownloadFromMultipleMirrors() {
            var mirrorSelector = SetupMultiMirrorSelector();
            var downloader = SetupDefaultDownloader();
            var mDownloader = new MultiMirrorFileDownloader(downloader, mirrorSelector);

            Action act = () => mDownloader.Download(new MultiMirrorFileDownloadSpec("a", "C:\\b".ToAbsoluteFilePath()));

            act.ShouldThrow<HostListExhausted>();
            A.CallTo(() => mirrorSelector.Failure(httpHost1))
                .MustHaveHappened(Repeated.Exactly.Once);
            A.CallTo(() => mirrorSelector.Failure(httpHost2))
                .MustHaveHappened(Repeated.Exactly.Once);
        }
コード例 #2
0
        public void DownloadSucceedsWhenVerificationSucceeds() {
            var mirrorSelector = SetupMultiMirrorSelector();
            var downloader = A.Fake<IFileDownloader>();
            var mDownloader = new MultiMirrorFileDownloader(downloader, mirrorSelector);

            Action act =
                () =>
                    mDownloader.Download(new MultiMirrorFileDownloadSpec("a", "C:\\b".ToAbsoluteFilePath(), f => true));

            act.ShouldNotThrow<HostListExhausted>();
        }
コード例 #3
0
        public void SuccessDownloadShouldBeRegistered() {
            var mirrorSelector = SetupDefaultMirrorSelector();
            var downloader = A.Fake<IFileDownloader>();
            var mDownloader = new MultiMirrorFileDownloader(downloader, mirrorSelector);

            mDownloader.Download(new MultiMirrorFileDownloadSpec("a", @"C:\temp\a".ToAbsoluteFilePath()));

            A.CallTo(() => mirrorSelector.GetHost())
                .MustHaveHappened(Repeated.Exactly.Once);
            A.CallTo(() => downloader.Download(new Uri("http://testhost/a"), @"C:\temp\a".ToAbsoluteFilePath()))
                .MustHaveHappened(Repeated.Exactly.Once);
            A.CallTo(() => mirrorSelector.Success(httpTesthost))
                .MustHaveHappened(Repeated.Exactly.Once);
        }