public void UriUtilsTestCombineUriToString(string basePath, string additionalPath, string expected) { //Assign //Act var result = UriUtils.CombineUriToString(basePath, additionalPath); //Assert result.Should().Be(expected); }
//Take the screenshots from the browser protected void TakeScreenshots(ExecutionOptions options, IUserConfig userConfig) { _logger.LogDebug("Starting the screenshot mode"); var parallelOptions = new ParallelOptions() { MaxDegreeOfParallelism = userConfig.NumberOfThreads <= 0 ? 10 : userConfig.NumberOfThreads }; var browser = _browserFactory.GetBrowserFromConfig(userConfig); Parallel.ForEach(userConfig.Urls, parallelOptions, (url) => { _logger.LogInformation($"Screenshoting: '{url}'"); foreach (var width in userConfig.ScreenWidth) { var argument = new ScriptArguments() { ScreenWidth = width, UrlName = url.Key, Url = UriUtils.CombineUriToString(userConfig.Domain, url.Value), TargetPath = GetTargetPath(userConfig, url.Key, width) }; browser.ErrorDataReceived += (sender, args) => { _logger.LogError(EventIds.BrowserErrorMessage, $"BROWSER ERROR : {args.Response}"); }; browser.OutputDataReceived += (sender, args) => { _logger.LogInformation(EventIds.BrowserErrorMessage, $"BROWSER : {args.Response}"); }; browser.ExecuteScript(userConfig.ScriptFileFullPath, argument); } }); }