Remove unused code, dependency
This commit is contained in:
parent
4ce8155176
commit
1d8f3fe62a
|
|
@ -27,7 +27,6 @@
|
|||
<MicrosoftAspNetCorePackageVersion>2.2.0-preview1-34203</MicrosoftAspNetCorePackageVersion>
|
||||
<MicrosoftAspNetCoreRewritePackageVersion>2.2.0-preview1-34203</MicrosoftAspNetCoreRewritePackageVersion>
|
||||
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>2.2.0-preview1-34203</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
|
||||
<MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>0.6.0-preview1-34203</MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>
|
||||
<MicrosoftAspNetCoreServerKestrelHttpsPackageVersion>2.2.0-preview1-34203</MicrosoftAspNetCoreServerKestrelHttpsPackageVersion>
|
||||
<MicrosoftAspNetCoreServerKestrelPackageVersion>2.2.0-preview1-34203</MicrosoftAspNetCoreServerKestrelPackageVersion>
|
||||
<MicrosoftAspNetCoreStaticFilesPackageVersion>2.2.0-preview1-34203</MicrosoftAspNetCoreStaticFilesPackageVersion>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="$(MicrosoftAspNetCorePackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Server.IntegrationTesting" Version="$(MicrosoftAspNetCoreServerIntegrationTestingPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="$(MicrosoftAspNetCoreTestHostPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(MicrosoftAspNetCoreTestingPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="$(MicrosoftAspNetCoreMvcTestingPackageVersion)" />
|
||||
|
|
|
|||
|
|
@ -1,93 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit.Sdk;
|
||||
|
||||
namespace AuthSamples.FunctionalTests
|
||||
{
|
||||
public static class TestServices
|
||||
{
|
||||
public static string WorkingDirectory { get; } = AppContext.BaseDirectory;
|
||||
|
||||
public static void LogResponseOnFailedAssert(this ILogger logger, HttpResponseMessage response, string responseText, Action assert)
|
||||
{
|
||||
try
|
||||
{
|
||||
assert();
|
||||
}
|
||||
catch (XunitException)
|
||||
{
|
||||
logger.LogWarning(response.ToString());
|
||||
if (!string.IsNullOrEmpty(responseText))
|
||||
{
|
||||
logger.LogWarning(responseText);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task RunSiteTest(
|
||||
string siteName,
|
||||
ServerType serverType,
|
||||
RuntimeFlavor runtimeFlavor,
|
||||
RuntimeArchitecture architecture,
|
||||
ApplicationType applicationType,
|
||||
ILoggerFactory loggerFactory,
|
||||
Func<HttpClient, ILogger, CancellationToken, Task> validator)
|
||||
{
|
||||
var logger = loggerFactory.CreateLogger(siteName);
|
||||
var targetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net461" : "netcoreapp2.2";
|
||||
|
||||
var deploymentParameters = new DeploymentParameters(GetApplicationDirectory(siteName), serverType, runtimeFlavor, architecture)
|
||||
{
|
||||
SiteName = "HttpTestSite",
|
||||
ServerConfigTemplateContent = serverType == ServerType.Nginx ? File.ReadAllText(Path.Combine(WorkingDirectory, "nginx.conf")) : string.Empty,
|
||||
PublishApplicationBeforeDeployment = true,
|
||||
TargetFramework = targetFramework,
|
||||
ApplicationType = applicationType
|
||||
};
|
||||
|
||||
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory))
|
||||
{
|
||||
logger.LogInformation($"Running deployment for {siteName}:{serverType}:{runtimeFlavor}:{architecture}");
|
||||
var deploymentResult = await deployer.DeployAsync();
|
||||
deploymentResult.HttpClient.Timeout = TimeSpan.FromSeconds(10);
|
||||
|
||||
logger.LogInformation($"Running validation for {siteName}:{serverType}:{runtimeFlavor}:{architecture}");
|
||||
await validator(deploymentResult.HttpClient, logger, deploymentResult.HostShutdownToken);
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetApplicationDirectory(string applicationName)
|
||||
{
|
||||
var solutionRoot = GetSolutionDirectory();
|
||||
return Path.Combine(solutionRoot, "samples", applicationName);
|
||||
}
|
||||
|
||||
public static string GetSolutionDirectory()
|
||||
{
|
||||
var applicationBasePath = AppContext.BaseDirectory;
|
||||
var directoryInfo = new DirectoryInfo(applicationBasePath);
|
||||
do
|
||||
{
|
||||
var solutionFile = new FileInfo(Path.Combine(directoryInfo.FullName, "AuthSamples.sln"));
|
||||
if (solutionFile.Exists)
|
||||
{
|
||||
return directoryInfo.FullName;
|
||||
}
|
||||
|
||||
directoryInfo = directoryInfo.Parent;
|
||||
}
|
||||
while (directoryInfo.Parent != null);
|
||||
|
||||
throw new Exception($"Solution root could not be located using application root {applicationBasePath}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue