示例#1
0
        public async Task WebAppIsFound_WithAndWithoutProxy()
        {
            IAzure         azure         = null;
            IResourceGroup resourceGroup = null;
            IWebApp        webApp;

            try
            {
                (azure, resourceGroup, webApp) = await SetUpAzureWebApp();

                azure.Should().NotBeNull();
                resourceGroup.Should().NotBeNull();
                webApp.Should().NotBeNull();

                await CommandTestBuilder.CreateAsync <HealthCheckCommand, Program>()
                .WithArrange(context => SetUpVariables(context, resourceGroup.Name, webApp.Name))
                .WithAssert(result => result.WasSuccessful.Should().BeTrue())
                .Execute();

                // Here we verify whether the proxy is correctly picked up
                // Since the proxy we use here is non-existent, health check to the same Web App should fail due this this proxy setting
                SetLocalEnvironmentProxySettings(NonExistentProxyHostname, NonExistentProxyPort);
                SetCiEnvironmentProxySettings(NonExistentProxyHostname, NonExistentProxyPort);
                await CommandTestBuilder.CreateAsync <HealthCheckCommand, Program>()
                .WithArrange(context => SetUpVariables(context, resourceGroup.Name, webApp.Name))
                .WithAssert(result => result.WasSuccessful.Should().BeFalse())
                .Execute(false);
            }
            finally
            {
                RestoreLocalEnvironmentProxySettings();
                RestoreCiEnvironmentProxySettings();
                await CleanResources(azure, resourceGroup);
            }
        }