From f272d993deca66175dc48be3f5ab14e22d15208e Mon Sep 17 00:00:00 2001 From: BrennanConroy Date: Wed, 23 Mar 2016 16:33:06 -0700 Subject: [PATCH] Helper --- .../HelloWorldTest.cs | 12 +----------- .../ServerComparison.FunctionalTests/Helpers.cs | 17 ++++++++++++++++- .../ResponseTests.cs | 12 +----------- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/test/ServerComparison.FunctionalTests/HelloWorldTest.cs b/test/ServerComparison.FunctionalTests/HelloWorldTest.cs index 11cce9f1c8..daa902bb4f 100644 --- a/test/ServerComparison.FunctionalTests/HelloWorldTest.cs +++ b/test/ServerComparison.FunctionalTests/HelloWorldTest.cs @@ -66,21 +66,11 @@ namespace ServerComparison.FunctionalTests using (logger.BeginScope("HelloWorldTest")) { - string content = null; - if (serverType == ServerType.IISExpress) - { - content = File.ReadAllText("Http.config"); - } - else if (serverType == ServerType.Nginx) - { - content = File.ReadAllText("nginx.conf"); - } - var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(), serverType, runtimeFlavor, architecture) { ApplicationBaseUriHint = applicationBaseUrl, EnvironmentName = "HelloWorld", // Will pick the Start class named 'StartupHelloWorld', - ServerConfigTemplateContent = content, + ServerConfigTemplateContent = Helpers.GetConfigContent(serverType), SiteName = "HttpTestSite", // This is configured in the Http.config PublishTargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "dnx451" : "netstandardapp1.5" }; diff --git a/test/ServerComparison.FunctionalTests/Helpers.cs b/test/ServerComparison.FunctionalTests/Helpers.cs index 5e57d68d9d..81c4b3b88f 100644 --- a/test/ServerComparison.FunctionalTests/Helpers.cs +++ b/test/ServerComparison.FunctionalTests/Helpers.cs @@ -1,8 +1,8 @@ // 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 System; using System.IO; +using Microsoft.AspNetCore.Server.Testing; namespace ServerComparison.FunctionalTests { @@ -12,5 +12,20 @@ namespace ServerComparison.FunctionalTests { return Path.GetFullPath(Path.Combine("..", "..", "..", "..", "..", "ServerComparison.TestSites")); } + + public static string GetConfigContent(ServerType serverType) + { + string content = null; + if (serverType == ServerType.IISExpress) + { + content = File.ReadAllText("Http.config"); + } + else if (serverType == ServerType.Nginx) + { + content = File.ReadAllText("nginx.conf"); + } + + return content; + } } } \ No newline at end of file diff --git a/test/ServerComparison.FunctionalTests/ResponseTests.cs b/test/ServerComparison.FunctionalTests/ResponseTests.cs index 185a7f5ab5..e50c842511 100644 --- a/test/ServerComparison.FunctionalTests/ResponseTests.cs +++ b/test/ServerComparison.FunctionalTests/ResponseTests.cs @@ -136,21 +136,11 @@ namespace ServerComparison.FunctionalTests using (logger.BeginScope("ResponseFormatsTest")) { - string content = null; - if (serverType == ServerType.IISExpress) - { - content = File.ReadAllText("Http.config"); - } - else if (serverType == ServerType.Nginx) - { - content = File.ReadAllText("nginx.conf"); - } - var deploymentParameters = new DeploymentParameters(Helpers.GetApplicationPath(), serverType, runtimeFlavor, architecture) { ApplicationBaseUriHint = applicationBaseUrl, EnvironmentName = "Responses", - ServerConfigTemplateContent = content, + ServerConfigTemplateContent = Helpers.GetConfigContent(serverType), SiteName = "HttpTestSite", // This is configured in the Http.config PublishTargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "dnx451" : "netstandardapp1.5" };