Beispiel #1
0
 public UpdateSessionFake(bool createMocksForCreateMethods = false)
 {
     if (createMocksForCreateMethods)
     {
         Downloader = new UpdateDownloaderFake();
         Searcher   = new UpdateSearcherFake();
         Installer  = new UpdateInstallerFake();
     }
 }
        public WuApiSimulator Configure()
        {
            if (IsReady)
            {
                throw new InvalidOperationException("Simulation is already configured");
            }
            _updates = GenerateUpdateCollection();
            var uSearcher = new UpdateSearcherFake();

            uSearcher.FakeSearchResult = CommonMocks.GetSearchResult(_updates, OperationResultCode.orcSucceeded);
            uSearcher.FakeSearchTimeMs = (_searchTimeMs == 0)?_rnd.Next(10000, 20000):_searchTimeMs;
            var uDownloader = new UpdateDownloaderFake();

            uDownloader.FakeDownloadTimeMs = (_downloadTimeMs == 0) ? _rnd.Next(10000, 20000) : _downloadTimeMs;
            var uInstaller = new UpdateInstallerFake();

            uInstaller.FakeInstallTimeMs = (_installTimeMs == 0) ? _rnd.Next(10000, 20000) : _installTimeMs;
            _uSession            = new UpdateSessionFake(false);
            _uSession.Downloader = uDownloader;
            _uSession.Searcher   = uSearcher;
            _uSession.Installer  = uInstaller;
            IsReady = true;
            return(this);
        }