Updating Xunit and dotnet versions (#143)

This commit is contained in:
Justin Kotalik 2017-09-25 15:10:31 -07:00 committed by GitHub
parent 2e540341db
commit f130330db8
9 changed files with 55 additions and 99 deletions

View File

@ -2,7 +2,8 @@
<PropertyGroup> <PropertyGroup>
<AspNetCoreVersion>1.2.0-*</AspNetCoreVersion> <AspNetCoreVersion>1.2.0-*</AspNetCoreVersion>
<InternalAspNetCoreSdkVersion>2.1.1-*</InternalAspNetCoreSdkVersion> <InternalAspNetCoreSdkVersion>2.1.1-*</InternalAspNetCoreSdkVersion>
<TestSdkVersion>15.3.0-*</TestSdkVersion> <TestSdkVersion>15.3.0</TestSdkVersion>
<XunitVersion>2.3.0-beta2-*</XunitVersion> <XunitAnalyzersVersion>0.6.1</XunitAnalyzersVersion>
<XunitVersion>2.3.0-beta4-build3742</XunitVersion>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -1063,17 +1063,22 @@ Finished:
if (strEventMsg.IsEmpty()) if (strEventMsg.IsEmpty())
{ {
if (!fDonePrepareCommandLine) if (!fDonePrepareCommandLine)
{
strEventMsg.SafeSnwprintf( strEventMsg.SafeSnwprintf(
m_struAppFullPath.QueryStr(), m_struAppFullPath.QueryStr(),
ASPNETCORE_EVENT_PROCESS_START_INTERNAL_ERROR_MSG, ASPNETCORE_EVENT_PROCESS_START_INTERNAL_ERROR_MSG,
hr); hr);
}
else else
{
strEventMsg.SafeSnwprintf( strEventMsg.SafeSnwprintf(
ASPNETCORE_EVENT_PROCESS_START_POSTCREATE_ERROR_MSG, ASPNETCORE_EVENT_PROCESS_START_POSTCREATE_ERROR_MSG,
m_struAppFullPath.QueryStr(), m_struAppFullPath.QueryStr(),
m_pszRootApplicationPath.QueryStr(), m_pszRootApplicationPath.QueryStr(),
struCommandLine.QueryStr(), struCommandLine.QueryStr(),
hr); hr);
}
} }
apsz[0] = strEventMsg.QueryStr(); apsz[0] = strEventMsg.QueryStr();

View File

@ -196,9 +196,9 @@ namespace AspNetCoreModule.Test.Framework
} }
// //
// Currently we use DotnetCore v1.0 // Currently we use DotnetCore v2.0
// //
string publishPath = Path.Combine(srcPath, "bin", "Debug", "netcoreapp1.0", "publish"); string publishPath = Path.Combine(srcPath, "bin", "Debug", "netcoreapp2.0", "publish");
string publishPathOutput = Path.Combine(Environment.ExpandEnvironmentVariables("%SystemDrive%") + @"\", "inetpub", "ANCMTest", "publishPathOutput"); string publishPathOutput = Path.Combine(Environment.ExpandEnvironmentVariables("%SystemDrive%") + @"\", "inetpub", "ANCMTest", "publishPathOutput");
// //

View File

@ -898,8 +898,8 @@ namespace AspNetCoreModule.Test
requestHeaders = await GetResponse(testSite.AspNetCoreApp.GetUri("DumpRequestHeaders"), HttpStatusCode.OK); requestHeaders = await GetResponse(testSite.AspNetCoreApp.GetUri("DumpRequestHeaders"), HttpStatusCode.OK);
if (enabledForwardWindowsAuthToken) if (enabledForwardWindowsAuthToken)
{ {
string expectedHeaderName = "MS-ASPNETCORE-WINAUTHTOKEN";
Assert.Contains(expectedHeaderName, requestHeaders.ToUpper()); Assert.Contains("MS-ASPNETCORE-WINAUTHTOKEN", requestHeaders.ToUpper());
result = await GetResponse(testSite.AspNetCoreApp.GetUri("ImpersonateMiddleware"), HttpStatusCode.OK); result = await GetResponse(testSite.AspNetCoreApp.GetUri("ImpersonateMiddleware"), HttpStatusCode.OK);
bool compare = false; bool compare = false;
@ -1376,8 +1376,8 @@ namespace AspNetCoreModule.Test
// Verify https request with client certificate includes the certificate header "MS-ASPNETCORE-CLIENTCERT" // Verify https request with client certificate includes the certificate header "MS-ASPNETCORE-CLIENTCERT"
Uri targetHttpsUriForDumpRequestHeaders = testSite.AspNetCoreApp.GetUri("DumpRequestHeaders", sslPort, protocol: "https"); Uri targetHttpsUriForDumpRequestHeaders = testSite.AspNetCoreApp.GetUri("DumpRequestHeaders", sslPort, protocol: "https");
string outputRawContent = TestUtility.RunPowershellScript("( invoke-webrequest " + targetHttpsUriForDumpRequestHeaders.OriginalString + " -CertificateThumbprint " + thumbPrintForClientAuthentication + ").RawContent.ToString()"); string outputRawContent = TestUtility.RunPowershellScript("( invoke-webrequest " + targetHttpsUriForDumpRequestHeaders.OriginalString + " -CertificateThumbprint " + thumbPrintForClientAuthentication + ").RawContent.ToString()");
string expectedHeaderName = "MS-ASPNETCORE-CLIENTCERT";
Assert.Contains(expectedHeaderName, outputRawContent); Assert.Contains("MS-ASPNETCORE-CLIENTCERT", outputRawContent);
// Get the value of MS-ASPNETCORE-CLIENTCERT request header again and verify it is matched to its configured public key // Get the value of MS-ASPNETCORE-CLIENTCERT request header again and verify it is matched to its configured public key
Uri targetHttpsUriForCLIENTCERTRequestHeader = testSite.AspNetCoreApp.GetUri("GetRequestHeaderValueMS-ASPNETCORE-CLIENTCERT", sslPort, protocol: "https"); Uri targetHttpsUriForCLIENTCERTRequestHeader = testSite.AspNetCoreApp.GetUri("GetRequestHeaderValueMS-ASPNETCORE-CLIENTCERT", sslPort, protocol: "https");
@ -2337,7 +2337,6 @@ namespace AspNetCoreModule.Test
} }
TestUtility.LogInformation(responseText); TestUtility.LogInformation(responseText);
TestUtility.LogInformation(responseStatus); TestUtility.LogInformation(responseStatus);
throw;
} }
return result; return result;
} }

View File

@ -1,21 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework> <TargetFramework>netcoreapp2.0</TargetFramework>
<RuntimeFrameworkVersion>1.0.5</RuntimeFrameworkVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.*" /> <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.WebSockets.Server" Version="0.1.*" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.0.*" />
<PackageReference Include="Microsoft.AspNetCore" Version="1.0.*" />
<PackageReference Include="Microsoft.AspNetCore.Server.WebListener" Version="1.0.*" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Https" Version="1.0.*" />
<PackageReference Include="Microsoft.AspNetCore.ResponseCompression" Version="1.0.*" />
<PackageReference Include="Microsoft.AspNetCore.ResponseCaching" Version="1.0.*" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.0.*" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="1.0.*" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.0.*" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -4,11 +4,11 @@
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.Kestrel.Https; using Microsoft.AspNetCore.Server.Kestrel.Https;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Net.Http.Server;
using System; using System;
using System.IO; using System.IO;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using System.Threading; using System.Threading;
using System.Net;
namespace AspnetCoreModule.TestSites.Standard namespace AspnetCoreModule.TestSites.Standard
{ {
@ -46,14 +46,7 @@ namespace AspnetCoreModule.TestSites.Standard
builder = new WebHostBuilder() builder = new WebHostBuilder()
.UseConfiguration(config) .UseConfiguration(config)
.UseIISIntegration() .UseIISIntegration()
.UseKestrel(options => .UseKestrel()
{
HttpsConnectionFilterOptions httpsoptions = new HttpsConnectionFilterOptions();
httpsoptions.ServerCertificate = _x509Certificate2;
httpsoptions.ClientCertificateMode = ClientCertificateMode.RequireCertificate;
httpsoptions.CheckCertificateRevocation = false;
options.UseHttps(httpsoptions);
})
.UseStartup<Startup>(); .UseStartup<Startup>();
} }
else if (startUpClassString == "StartupCompressionCaching") else if (startUpClassString == "StartupCompressionCaching")
@ -117,32 +110,7 @@ namespace AspnetCoreModule.TestSites.Standard
Startup.SleeptimeWhileClosing = Convert.ToInt32(shutdownDelay); Startup.SleeptimeWhileClosing = Convert.ToInt32(shutdownDelay);
} }
// Switch between Kestrel and WebListener for different tests. Default to Kestrel for normal app execution. builder.UseKestrel();
if (string.Equals(builder.GetSetting("server"), "Microsoft.AspNetCore.Server.WebListener", System.StringComparison.Ordinal))
{
if (string.Equals(builder.GetSetting("environment") ??
Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"),
"NtlmAuthentication", System.StringComparison.Ordinal))
{
// Set up NTLM authentication for WebListener as follows.
// For IIS and IISExpress use inetmgr to setup NTLM authentication on the application or
// modify the applicationHost.config to enable NTLM.
builder.UseWebListener(options =>
{
options.ListenerSettings.Authentication.AllowAnonymous = true;
options.ListenerSettings.Authentication.Schemes =
AuthenticationSchemes.Negotiate | AuthenticationSchemes.NTLM;
});
}
else
{
builder.UseWebListener();
}
}
else
{
builder.UseKestrel();
}
var host = builder.Build(); var host = builder.Build();
AappLifetime = (IApplicationLifetime)host.Services.GetService(typeof(IApplicationLifetime)); AappLifetime = (IApplicationLifetime)host.Services.GetService(typeof(IApplicationLifetime));
@ -152,7 +120,6 @@ namespace AspnetCoreModule.TestSites.Standard
{ {
GracefulShutdownDelayTime = Convert.ToInt32(gracefulShutdownDelay); GracefulShutdownDelayTime = Convert.ToInt32(gracefulShutdownDelay);
} }
AappLifetime.ApplicationStarted.Register( AappLifetime.ApplicationStarted.Register(
() => { () => {
Thread.Sleep(1000); Thread.Sleep(1000);

View File

@ -28,9 +28,6 @@ namespace AspnetCoreModule.TestSites.Standard
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.Configure<IISOptions>(options => { services.Configure<IISOptions>(options => {
// Considering the default value of ForwardWindowsAuthentication is true,
// the below line is not required at present, however keeping in case the default value is changed later.
options.ForwardWindowsAuthentication = true;
}); });
} }
@ -73,7 +70,6 @@ namespace AspnetCoreModule.TestSites.Standard
{ {
app.UseWebSockets(new WebSocketOptions app.UseWebSockets(new WebSocketOptions
{ {
ReplaceFeature = true
}); });
subApp.Use(async (context, next) => subApp.Use(async (context, next) =>
@ -96,7 +92,6 @@ namespace AspnetCoreModule.TestSites.Standard
{ {
app.UseWebSockets(new WebSocketOptions app.UseWebSockets(new WebSocketOptions
{ {
ReplaceFeature = true
}); });
subApp.Use(async (context, next) => subApp.Use(async (context, next) =>

View File

@ -2,6 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for license information. // Licensed under the MIT License. See License.txt in the project root for license information.
using System; using System;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
@ -47,18 +48,19 @@ namespace AspnetCoreModule.TestSites.Standard
} }
else else
{ {
return context.Authentication.ChallengeAsync(); return context.ChallengeAsync();
} }
} }
if (context.Request.Path.Equals("/Forbidden")) if (context.Request.Path.Equals("/Forbidden"))
{ {
return context.Authentication.ForbidAsync(Microsoft.AspNetCore.Http.Authentication.AuthenticationManager.AutomaticScheme); return context.ForbidAsync();
} }
if (context.Request.Path.Equals("/AutoForbid")) if (context.Request.Path.Equals("/AutoForbid"))
{ {
return context.Authentication.ChallengeAsync(); return context.ChallengeAsync();
} }
if (context.Request.Path.Equals("/RestrictedNegotiate")) if (context.Request.Path.Equals("/RestrictedNegotiate"))
@ -69,7 +71,7 @@ namespace AspnetCoreModule.TestSites.Standard
} }
else else
{ {
return context.Authentication.ChallengeAsync("Negotiate"); return context.ChallengeAsync("Negotiate");
} }
} }
@ -81,7 +83,7 @@ namespace AspnetCoreModule.TestSites.Standard
} }
else else
{ {
return context.Authentication.ChallengeAsync("NTLM"); return context.ChallengeAsync("NTLM");
} }
} }