mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-01 05:55:27 +08:00 
			
		
		
		
	Set up acceptance tests on windows
This commit is contained in:
		| @@ -20,6 +20,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{5B401523-3 | ||||
| EndProject | ||||
| Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Ocelot.UnitTests", "test\Ocelot.UnitTests\Ocelot.UnitTests.xproj", "{54E84F1A-E525-4443-96EC-039CBD50C263}" | ||||
| EndProject | ||||
| Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Ocelot.AcceptanceTests", "test\Ocelot.AcceptanceTests\Ocelot.AcceptanceTests.xproj", "{F8C224FE-36BE-45F5-9B0E-666D8F4A9B52}" | ||||
| EndProject | ||||
| Global | ||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
| 		Debug|Any CPU = Debug|Any CPU | ||||
| @@ -38,6 +40,10 @@ Global | ||||
| 		{54E84F1A-E525-4443-96EC-039CBD50C263}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||||
| 		{54E84F1A-E525-4443-96EC-039CBD50C263}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||||
| 		{54E84F1A-E525-4443-96EC-039CBD50C263}.Release|Any CPU.Build.0 = Release|Any CPU | ||||
| 		{F8C224FE-36BE-45F5-9B0E-666D8F4A9B52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||||
| 		{F8C224FE-36BE-45F5-9B0E-666D8F4A9B52}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||||
| 		{F8C224FE-36BE-45F5-9B0E-666D8F4A9B52}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||||
| 		{F8C224FE-36BE-45F5-9B0E-666D8F4A9B52}.Release|Any CPU.Build.0 = Release|Any CPU | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(SolutionProperties) = preSolution | ||||
| 		HideSolutionNode = FALSE | ||||
| @@ -46,5 +52,6 @@ Global | ||||
| 		{AEC8FB40-B370-48A6-9B38-78E560041F01} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} | ||||
| 		{D6DF4206-0DBA-41D8-884D-C3E08290FDBB} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} | ||||
| 		{54E84F1A-E525-4443-96EC-039CBD50C263} = {5B401523-36DA-4491-B73A-7590A26E420B} | ||||
| 		{F8C224FE-36BE-45F5-9B0E-666D8F4A9B52} = {5B401523-36DA-4491-B73A-7590A26E420B} | ||||
| 	EndGlobalSection | ||||
| EndGlobal | ||||
|   | ||||
							
								
								
									
										22
									
								
								test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.xproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.xproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <PropertyGroup> | ||||
|     <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> | ||||
|     <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> | ||||
|   </PropertyGroup> | ||||
|   <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" /> | ||||
|   <PropertyGroup Label="Globals"> | ||||
|     <ProjectGuid>f8c224fe-36be-45f5-9b0e-666d8f4a9b52</ProjectGuid> | ||||
|     <RootNamespace>Ocelot.AcceptanceTests</RootNamespace> | ||||
|     <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath> | ||||
|     <OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath> | ||||
|     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup> | ||||
|     <SchemaVersion>2.0</SchemaVersion> | ||||
|   </PropertyGroup> | ||||
|   <ItemGroup> | ||||
|     <Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" /> | ||||
|   </ItemGroup> | ||||
|   <Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" /> | ||||
| </Project> | ||||
							
								
								
									
										19
									
								
								test/Ocelot.AcceptanceTests/Properties/AssemblyInfo.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								test/Ocelot.AcceptanceTests/Properties/AssemblyInfo.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| using System.Reflection; | ||||
| using System.Runtime.CompilerServices; | ||||
| using System.Runtime.InteropServices; | ||||
|  | ||||
| // General Information about an assembly is controlled through the following | ||||
| // set of attributes. Change these attribute values to modify the information | ||||
| // associated with an assembly. | ||||
| [assembly: AssemblyConfiguration("")] | ||||
| [assembly: AssemblyCompany("")] | ||||
| [assembly: AssemblyProduct("Ocelot.AcceptanceTests")] | ||||
| [assembly: AssemblyTrademark("")] | ||||
|  | ||||
| // Setting ComVisible to false makes the types in this assembly not visible | ||||
| // to COM components.  If you need to access a type in this assembly from | ||||
| // COM, set the ComVisible attribute to true on that type. | ||||
| [assembly: ComVisible(false)] | ||||
|  | ||||
| // The following GUID is for the ID of the typelib if this project is exposed to COM | ||||
| [assembly: Guid("f8c224fe-36be-45f5-9b0e-666d8f4a9b52")] | ||||
| @@ -1,24 +1,43 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.IO; | ||||
| using System.Linq; | ||||
| using System.Net.Http; | ||||
| using System.Threading.Tasks; | ||||
| using Microsoft.AspNetCore.Hosting; | ||||
| using Ocelot; | ||||
| using Microsoft.AspNetCore.TestHost; | ||||
| using Xunit; | ||||
|  | ||||
| namespace Ocelot.AcceptanceTests | ||||
| { | ||||
|     public class RouterTests | ||||
|     public class RouterTests : IDisposable | ||||
|     { | ||||
|         private readonly TestServer _server; | ||||
|         private readonly HttpClient _client; | ||||
|  | ||||
|         public RouterTests() | ||||
|         { | ||||
|             // Arrange | ||||
|             _server = new TestServer(new WebHostBuilder() | ||||
|                 .UseStartup<Startup>()); | ||||
|             _client = _server.CreateClient(); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void should_route_request() | ||||
|         public async Task ReturnHelloWorld() | ||||
|         { | ||||
|              | ||||
|             // Act | ||||
|             var response = await _client.GetAsync("/"); | ||||
|             response.EnsureSuccessStatusCode(); | ||||
|  | ||||
|             var responseString = await response.Content.ReadAsStringAsync(); | ||||
|  | ||||
|             // Assert | ||||
|             Assert.Equal("Hello from Tom", | ||||
|                 responseString); | ||||
|         } | ||||
|  | ||||
|         public void Dispose() | ||||
|         { | ||||
|             _client.Dispose(); | ||||
|             _server.Dispose(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| { | ||||
| { | ||||
|     "version": "1.0.0-*", | ||||
|  | ||||
|     "testRunner": "xunit", | ||||
| @@ -20,10 +20,11 @@ | ||||
|         "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0", | ||||
|         "Microsoft.AspNetCore.Http": "1.0.0", | ||||
|         "Ocelot.Library": "1.0.0-*", | ||||
|         "Ocelot": "1.0.0-*", | ||||
|         "xunit": "2.1.0", | ||||
|         "dotnet-test-xunit": "2.2.0-preview2-build1029", | ||||
|         "Shouldly": "2.8.0" | ||||
|         "Shouldly": "2.8.0", | ||||
|         "Ocelot": "1.0.0-*", | ||||
|         "Microsoft.AspNetCore.TestHost": "1.0.0" | ||||
|     }, | ||||
|  | ||||
|     "frameworks": { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 TomPallister
					TomPallister