public async Task Test_Execute_TestPerformance() { // Arrange var stopWatch = new Stopwatch(); var ipAddress = "0.0.0.0"; var oldHostFileContent = await TestHelpers.GetEmbeddedFileAsync("Resources/old-hosts"); _ = this.fileWrapperMock.Setup(f => f.ReadAllTextAsync(this.pathToHostsFile)) .ReturnsAsync(() => oldHostFileContent); var remoteHostFileUrls = new List <Uri> { new Uri("https://www.adawayapk.net/downloads/hostfiles/official/1_hosts.txt"), new Uri("https://www.adawayapk.net/downloads/hostfiles/official/2_ad_servers.txt"), new Uri("https://www.adawayapk.net/downloads/hostfiles/official/3_yoyohost.txt") }; var adAwayHost = new AdAwayHost(this.loggerMock.Object, this.hostFileDownloader, this.hostFileWriter); // Act stopWatch.Start(); await adAwayHost.UpdateHosts(remoteHostFileUrls, ipAddress); stopWatch.Stop(); // Assert Assert.That(stopWatch.Elapsed, Is.AtMost(TimeSpan.FromSeconds(10))); }
private static async Task ExecuteAsync() { var remoteHostFileUrls = GetRemoteHostFileUrls(); var adAwayHost = new AdAwayHost(log, hostFileDownloader, hostFileWriter); await adAwayHost.UpdateHosts(remoteHostFileUrls, appConfiguration.ConfigurationOptions.IpAddress); }