diff --git a/src/MusicStore/project.json b/src/MusicStore/project.json index 8dc001e440..5284eff0d5 100644 --- a/src/MusicStore/project.json +++ b/src/MusicStore/project.json @@ -2,31 +2,30 @@ "authors": [ "Microsoft" ], - "description": "Music store application on K", + "description": "Music store application on ASP.NET 5", "version": "1.0.0-*", "compilationOptions": { "warningsAsErrors": true, "define": [ "DEMO", "TESTING" ] }, "packExclude": "*.cmd", "webroot": "wwwroot", "dependencies": { + "EntityFramework.SqlServer": "7.0.0-*", + "EntityFramework.InMemory": "7.0.0-*", //For Mono "Kestrel": "1.0.0-*", - "Microsoft.AspNet.Server.IIS": "1.0.0-*", - "Microsoft.AspNet.Mvc": "6.0.0-*", - "Microsoft.AspNet.Server.WebListener": "1.0.0-*", "Microsoft.AspNet.Diagnostics": "1.0.0-*", "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-*", + "Microsoft.AspNet.Mvc": "6.0.0-*", "Microsoft.AspNet.Security.Cookies": "1.0.0-*", "Microsoft.AspNet.Security.Facebook": "1.0.0-*", "Microsoft.AspNet.Security.Google": "1.0.0-*", "Microsoft.AspNet.Security.MicrosoftAccount": "1.0.0-*", "Microsoft.AspNet.Security.Twitter": "1.0.0-*", - "Microsoft.AspNet.StaticFiles": "1.0.0-*", - "EntityFramework.SqlServer": "7.0.0-*", - /*For Mono*/ - "EntityFramework.InMemory": "7.0.0-*", - "Microsoft.Framework.ConfigurationModel.Json": "1.0.0-*", - "Microsoft.Framework.OptionsModel": "1.0.0-*", + "Microsoft.AspNet.Server.IIS": "1.0.0-*", + "Microsoft.AspNet.Server.WebListener": "1.0.0-*", "Microsoft.AspNet.SignalR.Server": "3.0.0-*", - "Microsoft.Framework.Cache.Memory": "1.0.0-*" + "Microsoft.AspNet.StaticFiles": "1.0.0-*", + "Microsoft.Framework.Cache.Memory": "1.0.0-*", + "Microsoft.Framework.ConfigurationModel.Json": "1.0.0-*", + "Microsoft.Framework.OptionsModel": "1.0.0-*" }, "commands": { "WebListener": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5002", @@ -37,4 +36,4 @@ "aspnet50": { }, "aspnetcore50": { } } -} +} \ No newline at end of file diff --git a/test/E2ETests/DbUtils.cs b/test/E2ETests/Common/DbUtils.cs similarity index 100% rename from test/E2ETests/DbUtils.cs rename to test/E2ETests/Common/DbUtils.cs diff --git a/test/E2ETests/DeploymentUtility.cs b/test/E2ETests/Common/DeploymentUtility.cs similarity index 99% rename from test/E2ETests/DeploymentUtility.cs rename to test/E2ETests/Common/DeploymentUtility.cs index 98f8addb98..b3a648ea1f 100644 --- a/test/E2ETests/DeploymentUtility.cs +++ b/test/E2ETests/Common/DeploymentUtility.cs @@ -173,7 +173,7 @@ namespace E2ETests var klrMonoManaged = Path.Combine(kreBin, "klr.mono.managed.dll"); var applicationHost = Path.Combine(kreBin, "Microsoft.Framework.ApplicationHost"); - Console.WriteLine(string.Format("Executing command: {0} {1} {2} {3} {4}", monoPath, klrMonoManaged, startParameters.ApplicationPath, applicationHost, startParameters.ServerType.ToString())); + Console.WriteLine(string.Format("Executing command: {0} {1} {2} {3}", monoPath, klrMonoManaged, applicationHost, startParameters.ServerType.ToString())); var startInfo = new ProcessStartInfo { diff --git a/test/E2ETests/Extensions.cs b/test/E2ETests/Common/Extensions.cs similarity index 100% rename from test/E2ETests/Extensions.cs rename to test/E2ETests/Common/Extensions.cs diff --git a/test/E2ETests/Common/Helpers.cs b/test/E2ETests/Common/Helpers.cs new file mode 100644 index 0000000000..f2b971b4a6 --- /dev/null +++ b/test/E2ETests/Common/Helpers.cs @@ -0,0 +1,15 @@ +using System; + +namespace E2ETests +{ + public class Helpers + { + public static bool RunningOnMono + { + get + { + return Type.GetType("Mono.Runtime") != null; + } + } + } +} \ No newline at end of file diff --git a/test/E2ETests/HtmlDOMHelper.cs b/test/E2ETests/Common/HtmlDOMHelper.cs similarity index 100% rename from test/E2ETests/HtmlDOMHelper.cs rename to test/E2ETests/Common/HtmlDOMHelper.cs diff --git a/test/E2ETests/IISApplication.cs b/test/E2ETests/Common/IISApplication.cs similarity index 100% rename from test/E2ETests/IISApplication.cs rename to test/E2ETests/Common/IISApplication.cs diff --git a/test/E2ETests/KreArchitecture.cs b/test/E2ETests/Common/KreArchitecture.cs similarity index 100% rename from test/E2ETests/KreArchitecture.cs rename to test/E2ETests/Common/KreArchitecture.cs diff --git a/test/E2ETests/KreFlavor.cs b/test/E2ETests/Common/KreFlavor.cs similarity index 100% rename from test/E2ETests/KreFlavor.cs rename to test/E2ETests/Common/KreFlavor.cs diff --git a/test/E2ETests/ServerType.cs b/test/E2ETests/Common/ServerType.cs similarity index 100% rename from test/E2ETests/ServerType.cs rename to test/E2ETests/Common/ServerType.cs diff --git a/test/E2ETests/StartParameters.cs b/test/E2ETests/Common/StartParameters.cs similarity index 100% rename from test/E2ETests/StartParameters.cs rename to test/E2ETests/Common/StartParameters.cs diff --git a/test/E2ETests/Helpers.cs b/test/E2ETests/Helpers.cs deleted file mode 100644 index 8462c0fe3c..0000000000 --- a/test/E2ETests/Helpers.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; - -namespace E2ETests -{ - public class Helpers - { - public static bool RunningOnMono - { - get - { - return Type.GetType("Mono.Runtime") != null; - } - } - - public static bool SkipTestOnCurrentConfiguration(bool RunTestOnMono, KreArchitecture architecture, ServerType serverType) - { - if (RunTestOnMono && !RunningOnMono) - { - //Skip Mono variations on Windows - Console.WriteLine("Skipping mono variation on .NET"); - return true; - } - - if (!RunTestOnMono && RunningOnMono) - { - //Skip .net variations on mono - Console.WriteLine("Skipping .NET variation on mono"); - return true; - } - - // Check if processor architecture is x64, else skip test - if (architecture == KreArchitecture.amd64 && !Environment.Is64BitOperatingSystem) - { - Console.WriteLine("Skipping x64 test since machine is of type x86"); - return true; - } - - if (serverType == ServerType.IISNativeModule && - !(Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor >= 2)) - { - // Works only on 6.2 and above - Console.WriteLine("Skipping Native module test since machine is not Win2012R2/Win8.1 and above"); - return true; - } - - if (serverType == ServerType.IISNativeModule && - Environment.GetEnvironmentVariable("IIS_NATIVE_MODULE_SETUP") != "true") - { - // Native module variations require IIS setup. Once native module is setup on IIS, set the value of the environment - // variable to true to run the native module variation. - // TODO: Need a better way to detect native module on the machine. - Console.WriteLine("Skipping Native module test since native module is not installed on IIS."); - Console.WriteLine("Setup the native module and set the IIS_NATIVE_MODULE_SETUP to true to run the variation."); - return true; - } - - return false; - } - } -} \ No newline at end of file diff --git a/test/E2ETests/NtlmAuthentationTest.cs b/test/E2ETests/NtlmAuthentationTest.cs index 07b6221efd..3c810ed2cd 100644 --- a/test/E2ETests/NtlmAuthentationTest.cs +++ b/test/E2ETests/NtlmAuthentationTest.cs @@ -2,13 +2,15 @@ using System.Diagnostics; using System.IO; using System.Net.Http; +using Microsoft.AspNet.Testing.xunit; using Xunit; namespace E2ETests { public partial class SmokeTests { - [Theory] + [ConditionalTheory] + [OSSkipCondition(OperatingSystems.Unix | OperatingSystems.MacOSX)] [InlineData(ServerType.Helios, KreFlavor.CoreClr, KreArchitecture.x86, "http://localhost:5001/")] [InlineData(ServerType.Helios, KreFlavor.DesktopClr, KreArchitecture.amd64, "http://localhost:5001/")] [InlineData(ServerType.WebListener, KreFlavor.CoreClr, KreArchitecture.amd64, "http://localhost:5002/")] @@ -16,12 +18,6 @@ namespace E2ETests { Console.WriteLine("Variation Details : HostType = {0}, KreFlavor = {1}, Architecture = {2}, applicationBaseUrl = {3}", serverType, kreFlavor, architecture, applicationBaseUrl); - if (Helpers.SkipTestOnCurrentConfiguration(false, architecture, serverType)) - { - Assert.True(true); - return; - } - startParameters = new StartParameters { ServerType = serverType, diff --git a/test/E2ETests/PublishAndRunTests.cs b/test/E2ETests/PublishAndRunTests.cs index ed5d3e2fd6..49e41bc155 100644 --- a/test/E2ETests/PublishAndRunTests.cs +++ b/test/E2ETests/PublishAndRunTests.cs @@ -4,28 +4,44 @@ using System.IO; using System.Net; using System.Net.Http; using System.Threading; +using Microsoft.AspNet.Testing.xunit; using Xunit; namespace E2ETests { public partial class SmokeTests { - [Theory] - [InlineData(ServerType.Helios, KreFlavor.DesktopClr, KreArchitecture.x86, "http://localhost:5001/", false)] - [InlineData(ServerType.WebListener, KreFlavor.DesktopClr, KreArchitecture.amd64, "http://localhost:5002/", false)] + [ConditionalTheory] + [FrameworkSkipCondition(RuntimeFrameworks.Mono)] + [InlineData(ServerType.Helios, KreFlavor.DesktopClr, KreArchitecture.x86, "http://localhost:5001/")] + public void Publish_And_Run_Tests_On_X86(ServerType serverType, KreFlavor kreFlavor, KreArchitecture architecture, string applicationBaseUrl) + { + Publish_And_Run_Tests(serverType, kreFlavor, architecture, applicationBaseUrl); + } + + [ConditionalTheory] + [FrameworkSkipCondition(RuntimeFrameworks.DotNet)] + [InlineData(ServerType.Kestrel, KreFlavor.Mono, KreArchitecture.x86, "http://localhost:5004/")] + public void Publish_And_Run_Tests_On_Mono(ServerType serverType, KreFlavor kreFlavor, KreArchitecture architecture, string applicationBaseUrl) + { + Publish_And_Run_Tests(serverType, kreFlavor, architecture, applicationBaseUrl); + } + + [ConditionalTheory] + [FrameworkSkipCondition(RuntimeFrameworks.Mono)] + [InlineData(ServerType.Kestrel, KreFlavor.Mono, KreArchitecture.x86, "http://localhost:5004/")] + [InlineData(ServerType.WebListener, KreFlavor.DesktopClr, KreArchitecture.amd64, "http://localhost:5002/")] //https://github.com/aspnet/KRuntime/issues/642 - //[InlineData(ServerType.Helios, KreFlavor.CoreClr, KreArchitecture.amd64, "http://localhost:5001/", false)] - [InlineData(ServerType.Kestrel, KreFlavor.Mono, KreArchitecture.x86, "http://localhost:5004/", true)] - public void PublishAndRunTests(ServerType serverType, KreFlavor kreFlavor, KreArchitecture architecture, string applicationBaseUrl, bool runTestOnMono = false) + //[InlineData(ServerType.Helios, KreFlavor.CoreClr, KreArchitecture.amd64, "http://localhost:5001/")] + public void Publish_And_Run_Tests_On_AMD64(ServerType serverType, KreFlavor kreFlavor, KreArchitecture architecture, string applicationBaseUrl) + { + Publish_And_Run_Tests(serverType, kreFlavor, architecture, applicationBaseUrl); + } + + private void Publish_And_Run_Tests(ServerType serverType, KreFlavor kreFlavor, KreArchitecture architecture, string applicationBaseUrl) { Console.WriteLine("Variation Details : HostType = {0}, KreFlavor = {1}, Architecture = {2}, applicationBaseUrl = {3}", serverType, kreFlavor, architecture, applicationBaseUrl); - if (Helpers.SkipTestOnCurrentConfiguration(runTestOnMono, architecture, serverType)) - { - Assert.True(true); - return; - } - startParameters = new StartParameters { ServerType = serverType, diff --git a/test/E2ETests/SmokeTests.cs b/test/E2ETests/SmokeTests.cs index 4f6bc22543..94c83af96c 100644 --- a/test/E2ETests/SmokeTests.cs +++ b/test/E2ETests/SmokeTests.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using System.Net; using System.Net.Http; using System.Threading; +using Microsoft.AspNet.Testing.xunit; using Xunit; namespace E2ETests @@ -16,29 +17,63 @@ namespace E2ETests private HttpClientHandler httpClientHandler; private StartParameters startParameters; - [Theory] - [InlineData(ServerType.Helios, KreFlavor.DesktopClr, KreArchitecture.x86, "http://localhost:5001/", false)] - [InlineData(ServerType.WebListener, KreFlavor.DesktopClr, KreArchitecture.x86, "http://localhost:5002/", false)] - [InlineData(ServerType.Kestrel, KreFlavor.DesktopClr, KreArchitecture.x86, "http://localhost:5004/", false)] - [InlineData(ServerType.Helios, KreFlavor.CoreClr, KreArchitecture.x86, "http://localhost:5001/", false)] - [InlineData(ServerType.WebListener, KreFlavor.CoreClr, KreArchitecture.x86, "http://localhost:5002/", false)] - [InlineData(ServerType.Kestrel, KreFlavor.CoreClr, KreArchitecture.x86, "http://localhost:5004/", false)] - [InlineData(ServerType.WebListener, KreFlavor.DesktopClr, KreArchitecture.amd64, "http://localhost:5002/", false)] - [InlineData(ServerType.Kestrel, KreFlavor.Mono, KreArchitecture.x86, "http://localhost:5004/", true)] - [InlineData(ServerType.Helios, KreFlavor.CoreClr, KreArchitecture.amd64, "http://localhost:5001/", false)] - [InlineData(ServerType.Kestrel, KreFlavor.CoreClr, KreArchitecture.amd64, "http://localhost:5004/", false)] - [InlineData(ServerType.IISNativeModule, KreFlavor.CoreClr, KreArchitecture.x86, "http://localhost:5005/", false)] - [InlineData(ServerType.IISNativeModule, KreFlavor.CoreClr, KreArchitecture.amd64, "http://localhost:5005/", false)] - public void SmokeTestSuite(ServerType serverType, KreFlavor kreFlavor, KreArchitecture architecture, string applicationBaseUrl, bool runTestOnMono) + [ConditionalTheory] + [FrameworkSkipCondition(RuntimeFrameworks.Mono)] + [InlineData(ServerType.Helios, KreFlavor.DesktopClr, KreArchitecture.x86, "http://localhost:5001/")] + [InlineData(ServerType.WebListener, KreFlavor.DesktopClr, KreArchitecture.x86, "http://localhost:5002/")] + [InlineData(ServerType.Kestrel, KreFlavor.DesktopClr, KreArchitecture.x86, "http://localhost:5004/")] + [InlineData(ServerType.Helios, KreFlavor.CoreClr, KreArchitecture.x86, "http://localhost:5001/")] + [InlineData(ServerType.WebListener, KreFlavor.CoreClr, KreArchitecture.x86, "http://localhost:5002/")] + [InlineData(ServerType.Kestrel, KreFlavor.CoreClr, KreArchitecture.x86, "http://localhost:5004/")] + public void SmokeTestSuite_OnX86(ServerType serverType, KreFlavor kreFlavor, KreArchitecture architecture, string applicationBaseUrl) + { + SmokeTestSuite(serverType, kreFlavor, architecture, applicationBaseUrl); + } + + [ConditionalTheory] + [FrameworkSkipCondition(RuntimeFrameworks.Mono)] + [SkipOn32BitOS] + [InlineData(ServerType.WebListener, KreFlavor.DesktopClr, KreArchitecture.amd64, "http://localhost:5002/")] + [InlineData(ServerType.Helios, KreFlavor.CoreClr, KreArchitecture.amd64, "http://localhost:5001/")] + [InlineData(ServerType.Kestrel, KreFlavor.CoreClr, KreArchitecture.amd64, "http://localhost:5004/")] + public void SmokeTestSuite_OnAMD64(ServerType serverType, KreFlavor kreFlavor, KreArchitecture architecture, string applicationBaseUrl) + { + SmokeTestSuite(serverType, kreFlavor, architecture, applicationBaseUrl); + } + + [ConditionalTheory] + [FrameworkSkipCondition(RuntimeFrameworks.DotNet)] + [InlineData(ServerType.Kestrel, KreFlavor.Mono, KreArchitecture.x86, "http://localhost:5004/")] + public void SmokeTestSuite_OnMono(ServerType serverType, KreFlavor kreFlavor, KreArchitecture architecture, string applicationBaseUrl) + { + SmokeTestSuite(serverType, kreFlavor, architecture, applicationBaseUrl); + } + + [ConditionalTheory] + [SkipIfNativeModuleNotInstalled] + [FrameworkSkipCondition(RuntimeFrameworks.Mono)] + [OSSkipCondition(OperatingSystems.Win7And2008R2 | OperatingSystems.MacOSX | OperatingSystems.Unix)] + [InlineData(ServerType.IISNativeModule, KreFlavor.CoreClr, KreArchitecture.x86, "http://localhost:5005/")] + public void SmokeTestSuite_On_NativeModule_X86(ServerType serverType, KreFlavor kreFlavor, KreArchitecture architecture, string applicationBaseUrl) + { + SmokeTestSuite(serverType, kreFlavor, architecture, applicationBaseUrl); + } + + [ConditionalTheory] + [SkipIfNativeModuleNotInstalled] + [FrameworkSkipCondition(RuntimeFrameworks.Mono)] + [OSSkipCondition(OperatingSystems.Win7And2008R2 | OperatingSystems.MacOSX | OperatingSystems.Unix)] + [SkipOn32BitOS] + [InlineData(ServerType.IISNativeModule, KreFlavor.CoreClr, KreArchitecture.amd64, "http://localhost:5005/")] + public void SmokeTestSuite_On_NativeModule_AMD64(ServerType serverType, KreFlavor kreFlavor, KreArchitecture architecture, string applicationBaseUrl) + { + SmokeTestSuite(serverType, kreFlavor, architecture, applicationBaseUrl); + } + + private void SmokeTestSuite(ServerType serverType, KreFlavor kreFlavor, KreArchitecture architecture, string applicationBaseUrl) { Console.WriteLine("Variation Details : HostType = {0}, KreFlavor = {1}, Architecture = {2}, applicationBaseUrl = {3}", serverType, kreFlavor, architecture, applicationBaseUrl); - if (Helpers.SkipTestOnCurrentConfiguration(runTestOnMono, architecture, serverType)) - { - Assert.True(true); - return; - } - startParameters = new StartParameters { ServerType = serverType, diff --git a/test/E2ETests/project.json b/test/E2ETests/project.json index 93dd9b63ec..bb8ade99ed 100644 --- a/test/E2ETests/project.json +++ b/test/E2ETests/project.json @@ -1,13 +1,14 @@ { - "compilationOptions": { "warningsAsErrors": "true" }, + "compilationOptions": { "warningsAsErrors": true }, "commands": { "test": "xunit.runner.kre" }, "dependencies": { "Microsoft.AspNet.Server.IIS": "1.0.0-*", - "Microsoft.Framework.Runtime.Interfaces": "1.0.0-*", - "Microsoft.AspNet.WebUtilities": "1.0.0-*", "Microsoft.AspNet.SignalR.Client": "2.1.1", + "Microsoft.AspNet.Testing": "1.0.0-*", + "Microsoft.AspNet.WebUtilities": "1.0.0-*", + "Microsoft.Framework.Runtime.Interfaces": "1.0.0-*", "Microsoft.Web.Administration": "7.0.0", "xunit.runner.kre": "1.0.0-*" }, diff --git a/test/E2ETests/xunit/SkipIfNativeModuleNotInstalledAttribute.cs b/test/E2ETests/xunit/SkipIfNativeModuleNotInstalledAttribute.cs new file mode 100644 index 0000000000..1196b613ec --- /dev/null +++ b/test/E2ETests/xunit/SkipIfNativeModuleNotInstalledAttribute.cs @@ -0,0 +1,27 @@ +using System; +using Microsoft.AspNet.Testing.xunit; + +namespace E2ETests +{ + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] + public class SkipIfNativeModuleNotInstalledAttribute : Attribute, ITestCondition + { + public bool IsMet + { + get + { + // TODO: Need a better way to detect native module on the machine. + return Environment.GetEnvironmentVariable("IIS_NATIVE_MODULE_SETUP") == "true"; + } + } + + public string SkipReason + { + get + { + return "Skipping Native module test since native module is not installed on IIS. " + + "To run the test, setup the native module and set the environment variable IIS_NATIVE_MODULE_SETUP=true."; + } + } + } +} \ No newline at end of file diff --git a/test/E2ETests/xunit/SkipOn32BitOSAttribute.cs b/test/E2ETests/xunit/SkipOn32BitOSAttribute.cs new file mode 100644 index 0000000000..72cf3f5661 --- /dev/null +++ b/test/E2ETests/xunit/SkipOn32BitOSAttribute.cs @@ -0,0 +1,25 @@ +using System; +using Microsoft.AspNet.Testing.xunit; + +namespace E2ETests +{ + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] + public class SkipOn32BitOSAttribute : Attribute, ITestCondition + { + public bool IsMet + { + get + { + return Environment.Is64BitOperatingSystem; + } + } + + public string SkipReason + { + get + { + return "Skipping the AMD64 test since the OS is 32-bit"; + } + } + } +} \ No newline at end of file