public ISearchResult EndSearch(ISearchJob searchJob) { if (FakeSearchResult == null) { return(CommonMocks.GetSearchResult(new UpdateCollectionFake(), OperationResultCode.orcSucceeded)); } return(FakeSearchResult); }
public IDownloadResult EndDownload(IDownloadJob value) { if (FakeDownloadResult == null) { Updates.OfType <UpdateFake>().ToList().ForEach(u => u.IsDownloaded = true); return(CommonMocks.GetDownloadResult(OperationResultCode.orcSucceeded)); } return(FakeDownloadResult); }
public ISearchResult Search(string criteria) { Thread.Sleep(FakeSearchTimeMs); if (FakeSearchResult == null) { return(CommonMocks.GetSearchResult(new UpdateCollectionFake(), OperationResultCode.orcSucceeded)); } return(FakeSearchResult); }
public IInstallationResult EndInstall(IInstallationJob value) { if (FakeInstallResult == null) { Updates.OfType <UpdateFake>().ToList().ForEach(u => u.IsInstalled = true); return(CommonMocks.GetInstallationResult(OperationResultCode.orcSucceeded)); } return(FakeInstallResult); }
public IDownloadResult Download() { Thread.Sleep(FakeDownloadTimeMs); if (FakeDownloadResult == null) { Updates.OfType <UpdateFake>().ToList().ForEach(u => u.IsDownloaded = true); return(CommonMocks.GetDownloadResult(OperationResultCode.orcSucceeded)); } return(FakeDownloadResult); }
public IInstallationResult Install() { Thread.Sleep(FakeInstallTimeMs); if (FakeInstallResult == null) { Updates.OfType <UpdateFake>().ToList().ForEach(u => u.IsInstalled = true); return(CommonMocks.GetInstallationResult(OperationResultCode.orcSucceeded)); } return(FakeInstallResult); }
public UpdateFake(string updateID) { _identity = CommonMocks.GetUpdateIdentity(updateID); var behavMock = new Mock <IInstallationBehavior>(); behavMock.Setup(b => b.CanRequestUserInput).Returns(false); behavMock.Setup(b => b.Impact).Returns(InstallationImpact.iiNormal); behavMock.Setup(b => b.RebootBehavior).Returns(InstallationRebootBehavior.irbNeverReboots); _installationBehavior = behavMock.Object; }
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); }