public async Task <int> Handle(ValidateCommand cmd) { this.Initialize(cmd); try { using var httpClient = new HttpClient(); var gatewayAutomation = new GatewayAutomation(httpClient, this.logicTokenProviderFactory, this.gatewayOptions); var validationResult = await gatewayAutomation.ValidateAsync(cmd.FolderPath).ConfigureAwait(false); if (validationResult.IsError) { foreach (var error in validationResult.Errors) { Console.WriteLine(error.ToString()); } } else { Console.WriteLine(validationResult.ValidatePublishingResult.ToString()); } return(!validationResult.IsError ? 0 : 1); } catch (RestException re) { Console.WriteLine(re.Message); return(1); } }
public async Task <int> Handle(ValidateCommand cmd) { this.Initialize(cmd); try { using var httpClient = new HttpClient(); var gatewayAutomation = new GatewayAutomation(httpClient, this.logicTokenProviderFactory, this.gatewayOptions); var validationResult = await gatewayAutomation.ValidateAsync(cmd.FolderPath).ConfigureAwait(false); this.outputFormatter.PrintResults(validationResult); return(!validationResult.IsError ? 0 : 1); } catch (RestException re) { Console.WriteLine(re.Message); return(1); } }