public void UpdateOptionAsync_InstallerDownloadTimeGreaterZero() { Mock <IGitHubWrapper> githubMock = BuildGitHubWrapper(configInfo: CurrentUpgradeDataForDefaultOptionalUpgradeForInsider); githubMock.Setup(x => x.TryGetSpecificAsset(It.IsAny <Uri>(), It.IsAny <Stream>())) .Callback <Uri, Stream>((Uri, stream) => { Thread.Sleep(1); }) .Returns(true); AutoUpdate update = new AutoUpdate(githubMock.Object, () => TestInstalledVersion); // ensure that the timespans are 0 before calling UpdateAsync TimeSpan?installerDownloadTime = update.GetInstallerDownloadTime(); Assert.IsTrue(installerDownloadTime.HasValue); Assert.AreEqual(TimeSpan.Zero, installerDownloadTime.Value); TimeSpan?installerVerificationTime = update.GetInstallerVerificationTime(); Assert.IsTrue(installerVerificationTime.HasValue); Assert.AreEqual(TimeSpan.Zero, installerVerificationTime.Value); update.UpdateAsync().Wait(); // Ensure the timespans are > 0 after calling UpdateAsync installerDownloadTime = update.GetInstallerDownloadTime(); Assert.IsTrue(installerDownloadTime.HasValue); Assert.AreNotEqual(TimeSpan.Zero, installerDownloadTime.Value); installerVerificationTime = update.GetInstallerVerificationTime(); Assert.IsTrue(installerVerificationTime.HasValue); Assert.AreNotEqual(TimeSpan.Zero, installerVerificationTime.Value); githubMock.VerifyAll(); }