diff --git a/WireMock.Net Solution.sln b/WireMock.Net Solution.sln index 741353b0..43906e2a 100644 --- a/WireMock.Net Solution.sln +++ b/WireMock.Net Solution.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.6 +VisualStudioVersion = 15.0.26430.13 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{EF242EDF-7133-4277-9A0C-18744DE08707}" EndProject @@ -24,21 +24,23 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.ConsoleApplica {D3804228-91F4-4502-9595-39584E5A01AD} = {D3804228-91F4-4502-9595-39584E5A01AD} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.StandAlone", "src\WireMock.Net.StandAlone\WireMock.Net.StandAlone.csproj", "{668F689E-57B4-422E-8846-C0FF643CA999}" - ProjectSection(ProjectDependencies) = postProject - {D3804228-91F4-4502-9595-39584E5A01AD} = {D3804228-91F4-4502-9595-39584E5A01AD} - EndProjectSection -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Tests", "test\WireMock.Net.Tests\WireMock.Net.Tests.csproj", "{31DC2EF8-C3FE-467D-84BE-FB5D956E612E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.StandAlone.NETCoreApp", "src\WireMock.Net.StandAlone.NETCoreApp\WireMock.Net.StandAlone.NETCoreApp.csproj", "{14D7298C-2BE5-42C3-A3D5-9433E77218F9}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.Console.NETCoreApp", "examples\WireMock.Net.Console.NETCoreApp\WireMock.Net.Console.NETCoreApp.csproj", "{FE281639-B014-4C8A-96FA-141164A74713}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Console.Record.NETCoreApp", "examples\WireMock.Net.Console.Record.NETCoreApp\WireMock.Net.Console.Record.NETCoreApp.csproj", "{1995E414-F197-4AB4-90C2-68D806B5AF59}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.Client", "src\WireMock.Net.Client\WireMock.Net.Client.csproj", "{058D4B6C-C03E-49D0-91DB-A535B058FA0D}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.StandAlone", "src\WireMock.Net.StandAlone\WireMock.Net.StandAlone.csproj", "{B6269AAC-170A-43D5-8B9A-579DED3D9A95}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.StandAlone.NETCoreApp", "examples\WireMock.Net.StandAlone.NETCoreApp\WireMock.Net.StandAlone.NETCoreApp.csproj", "{10E16614-61CA-48D8-8BDD-664C13913DED}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.StandAlone.Net452", "examples\WireMock.Net.StandAlone.Net452\WireMock.Net.StandAlone.Net452.csproj", "{668F689E-57B4-422E-8846-C0FF643CA999}" + ProjectSection(ProjectDependencies) = postProject + {B6269AAC-170A-43D5-8B9A-579DED3D9A95} = {B6269AAC-170A-43D5-8B9A-579DED3D9A95} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -53,18 +55,10 @@ Global {668F689E-57B4-422E-8846-C0FF643CA268}.Debug|Any CPU.Build.0 = Debug|Any CPU {668F689E-57B4-422E-8846-C0FF643CA268}.Release|Any CPU.ActiveCfg = Release|Any CPU {668F689E-57B4-422E-8846-C0FF643CA268}.Release|Any CPU.Build.0 = Release|Any CPU - {668F689E-57B4-422E-8846-C0FF643CA999}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {668F689E-57B4-422E-8846-C0FF643CA999}.Debug|Any CPU.Build.0 = Debug|Any CPU - {668F689E-57B4-422E-8846-C0FF643CA999}.Release|Any CPU.ActiveCfg = Release|Any CPU - {668F689E-57B4-422E-8846-C0FF643CA999}.Release|Any CPU.Build.0 = Release|Any CPU {31DC2EF8-C3FE-467D-84BE-FB5D956E612E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {31DC2EF8-C3FE-467D-84BE-FB5D956E612E}.Debug|Any CPU.Build.0 = Debug|Any CPU {31DC2EF8-C3FE-467D-84BE-FB5D956E612E}.Release|Any CPU.ActiveCfg = Release|Any CPU {31DC2EF8-C3FE-467D-84BE-FB5D956E612E}.Release|Any CPU.Build.0 = Release|Any CPU - {14D7298C-2BE5-42C3-A3D5-9433E77218F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {14D7298C-2BE5-42C3-A3D5-9433E77218F9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {14D7298C-2BE5-42C3-A3D5-9433E77218F9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {14D7298C-2BE5-42C3-A3D5-9433E77218F9}.Release|Any CPU.Build.0 = Release|Any CPU {FE281639-B014-4C8A-96FA-141164A74713}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FE281639-B014-4C8A-96FA-141164A74713}.Debug|Any CPU.Build.0 = Debug|Any CPU {FE281639-B014-4C8A-96FA-141164A74713}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -77,6 +71,18 @@ Global {058D4B6C-C03E-49D0-91DB-A535B058FA0D}.Debug|Any CPU.Build.0 = Debug|Any CPU {058D4B6C-C03E-49D0-91DB-A535B058FA0D}.Release|Any CPU.ActiveCfg = Release|Any CPU {058D4B6C-C03E-49D0-91DB-A535B058FA0D}.Release|Any CPU.Build.0 = Release|Any CPU + {B6269AAC-170A-43D5-8B9A-579DED3D9A95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B6269AAC-170A-43D5-8B9A-579DED3D9A95}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B6269AAC-170A-43D5-8B9A-579DED3D9A95}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B6269AAC-170A-43D5-8B9A-579DED3D9A95}.Release|Any CPU.Build.0 = Release|Any CPU + {10E16614-61CA-48D8-8BDD-664C13913DED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {10E16614-61CA-48D8-8BDD-664C13913DED}.Debug|Any CPU.Build.0 = Debug|Any CPU + {10E16614-61CA-48D8-8BDD-664C13913DED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {10E16614-61CA-48D8-8BDD-664C13913DED}.Release|Any CPU.Build.0 = Release|Any CPU + {668F689E-57B4-422E-8846-C0FF643CA999}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {668F689E-57B4-422E-8846-C0FF643CA999}.Debug|Any CPU.Build.0 = Debug|Any CPU + {668F689E-57B4-422E-8846-C0FF643CA999}.Release|Any CPU.ActiveCfg = Release|Any CPU + {668F689E-57B4-422E-8846-C0FF643CA999}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -84,11 +90,12 @@ Global GlobalSection(NestedProjects) = preSolution {D3804228-91F4-4502-9595-39584E5A01AD} = {EF242EDF-7133-4277-9A0C-18744DE08707} {668F689E-57B4-422E-8846-C0FF643CA268} = {F0C22C47-DF71-463C-9B04-B4E0F3B8708A} - {668F689E-57B4-422E-8846-C0FF643CA999} = {EF242EDF-7133-4277-9A0C-18744DE08707} {31DC2EF8-C3FE-467D-84BE-FB5D956E612E} = {890A1DED-C229-4FA1-969E-AAC3BBFC05E5} - {14D7298C-2BE5-42C3-A3D5-9433E77218F9} = {EF242EDF-7133-4277-9A0C-18744DE08707} {FE281639-B014-4C8A-96FA-141164A74713} = {F0C22C47-DF71-463C-9B04-B4E0F3B8708A} {1995E414-F197-4AB4-90C2-68D806B5AF59} = {F0C22C47-DF71-463C-9B04-B4E0F3B8708A} {058D4B6C-C03E-49D0-91DB-A535B058FA0D} = {EF242EDF-7133-4277-9A0C-18744DE08707} + {B6269AAC-170A-43D5-8B9A-579DED3D9A95} = {EF242EDF-7133-4277-9A0C-18744DE08707} + {10E16614-61CA-48D8-8BDD-664C13913DED} = {F0C22C47-DF71-463C-9B04-B4E0F3B8708A} + {668F689E-57B4-422E-8846-C0FF643CA999} = {F0C22C47-DF71-463C-9B04-B4E0F3B8708A} EndGlobalSection EndGlobal diff --git a/appveyor.yml b/appveyor.yml index 5b831ef8..7843478a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,8 +20,8 @@ environment: before_build: - dotnet restore .\src\WireMock.Net\WireMock.Net.csproj -- dotnet restore .\src\WireMock.Net.StandAlone.NETCoreApp\WireMock.Net.StandAlone.NETCoreApp.csproj -- nuget restore .\src\WireMock.Net.Standalone\WireMock.Net.Standalone.csproj -PackagesDirectory packages +- dotnet restore .\src\WireMock.Net.Client\WireMock.Net.Client.csproj +- dotnet restore .\src\WireMock.Net.Standalone\WireMock.Net.Standalone.csproj - nuget restore .\examples\WireMock.Net.ConsoleApplication\WireMock.Net.ConsoleApplication.csproj -PackagesDirectory packages build_script: @@ -32,10 +32,8 @@ build_script: - dotnet restore .\test\WireMock.Net.Tests\WireMock.Net.Tests.csproj - dotnet build .\test\WireMock.Net.Tests\WireMock.Net.Tests.csproj -c %CONFIGURATION% -# build WireMock.Net.ConsoleApplication, WireMock.Net.StandAlone.NETCoreApp and WireMock.Net.Standalone -- dotnet build .\src\WireMock.Net.StandAlone.NETCoreApp\WireMock.Net.StandAlone.NETCoreApp.csproj -c %CONFIGURATION% -- cmd: msbuild .\examples\WireMock.Net.ConsoleApplication\WireMock.Net.ConsoleApplication.csproj /p:Configuration=%CONFIGURATION% -- cmd: msbuild .\src\WireMock.Net.Standalone\WireMock.Net.Standalone.csproj /p:Configuration=%CONFIGURATION% +# build WireMock.Net.Standalone +- dotnet msbuild .\src\WireMock.Net.Standalone\WireMock.Net.Standalone.csproj -c %CONFIGURATION% test_script: - nuget.exe install OpenCover -ExcludeVersion diff --git a/examples/WireMock.Net.StandAlone.NETCoreApp/Program.cs b/examples/WireMock.Net.StandAlone.NETCoreApp/Program.cs new file mode 100644 index 00000000..c53df7b9 --- /dev/null +++ b/examples/WireMock.Net.StandAlone.NETCoreApp/Program.cs @@ -0,0 +1,15 @@ +using System; + +namespace WireMock.Net.StandAlone.NETCoreApp +{ + class Program + { + static void Main(string[] args) + { + StandAloneApp.Start(args); + + Console.WriteLine("Press any key to stop the server"); + Console.ReadKey(); + } + } +} \ No newline at end of file diff --git a/src/WireMock.Net.StandAlone.NETCoreApp/WireMock.Net.StandAlone.NETCoreApp.csproj b/examples/WireMock.Net.StandAlone.NETCoreApp/WireMock.Net.StandAlone.NETCoreApp.csproj similarity index 57% rename from src/WireMock.Net.StandAlone.NETCoreApp/WireMock.Net.StandAlone.NETCoreApp.csproj rename to examples/WireMock.Net.StandAlone.NETCoreApp/WireMock.Net.StandAlone.NETCoreApp.csproj index ddeb3896..4053f066 100644 --- a/src/WireMock.Net.StandAlone.NETCoreApp/WireMock.Net.StandAlone.NETCoreApp.csproj +++ b/examples/WireMock.Net.StandAlone.NETCoreApp/WireMock.Net.StandAlone.NETCoreApp.csproj @@ -7,11 +7,7 @@ - - - - - + \ No newline at end of file diff --git a/examples/WireMock.Net.StandAlone.Net452/Program.cs b/examples/WireMock.Net.StandAlone.Net452/Program.cs new file mode 100644 index 00000000..3bba04b1 --- /dev/null +++ b/examples/WireMock.Net.StandAlone.Net452/Program.cs @@ -0,0 +1,15 @@ +using System; + +namespace WireMock.Net.StandAlone +{ + public class Program + { + static void Main(params string[] args) + { + StandAloneApp.Start(args); + + Console.WriteLine("Press any key to stop the server"); + Console.ReadKey(); + } + } +} \ No newline at end of file diff --git a/src/WireMock.Net.StandAlone/Properties/AssemblyInfo.cs b/examples/WireMock.Net.StandAlone.Net452/Properties/AssemblyInfo.cs similarity index 100% rename from src/WireMock.Net.StandAlone/Properties/AssemblyInfo.cs rename to examples/WireMock.Net.StandAlone.Net452/Properties/AssemblyInfo.cs diff --git a/examples/WireMock.Net.StandAlone.Net452/WireMock.Net.StandAlone.Net452.csproj b/examples/WireMock.Net.StandAlone.Net452/WireMock.Net.StandAlone.Net452.csproj new file mode 100644 index 00000000..7729b6cd --- /dev/null +++ b/examples/WireMock.Net.StandAlone.Net452/WireMock.Net.StandAlone.Net452.csproj @@ -0,0 +1,86 @@ + + + + + Debug + AnyCPU + {668F689E-57B4-422E-8846-C0FF643CA999} + Exe + Properties + WireMock.Net.StandAlone + WireMock.Net.StandAlone + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + ..\..\WireMock.Net-Logo.ico + + + + ..\..\packages\Handlebars.Net.1.9.0\lib\net40\Handlebars.dll + + + ..\..\packages\Microsoft.Owin.Host.HttpListener.3.1.0\lib\net45\Microsoft.Owin.Host.HttpListener.dll + + + ..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + + + ..\..\packages\RestEase.1.4.1\lib\net45\RestEase.dll + + + ..\..\packages\SimMetrics.Net.1.0.3\lib\net45\SimMetrics.Net.dll + + + + + + + + False + ..\..\src\WireMock.Net.StandAlone\bin\$(Configuration)\net452\WireMock.Net.dll + + + False + ..\..\src\WireMock.Net.StandAlone\bin\$(Configuration)\net452\WireMock.Net.StandAlone.dll + + + ..\..\packages\XPath2.1.0.3.1\lib\net452\XPath2.dll + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/WireMock.Net.StandAlone.Net452/packages.config b/examples/WireMock.Net.StandAlone.Net452/packages.config new file mode 100644 index 00000000..efe01026 --- /dev/null +++ b/examples/WireMock.Net.StandAlone.Net452/packages.config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/WireMock.Net.Client/WireMock.Net.Client.csproj b/src/WireMock.Net.Client/WireMock.Net.Client.csproj index 168e85f2..c5eba9a7 100644 --- a/src/WireMock.Net.Client/WireMock.Net.Client.csproj +++ b/src/WireMock.Net.Client/WireMock.Net.Client.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/WireMock.Net.StandAlone.NETCoreApp/Program.cs b/src/WireMock.Net.StandAlone.NETCoreApp/Program.cs deleted file mode 100644 index 63730958..00000000 --- a/src/WireMock.Net.StandAlone.NETCoreApp/Program.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using CommandLineParser.Arguments; -using CommandLineParser.Exceptions; -using WireMock.Server; -using WireMock.Settings; - -namespace WireMock.Net.StandAlone.NETCoreApp -{ - class Program - { - private class Options - { - [ValueArgument(typeof(string), "Urls", Description = "URL(s) to listen on.", Optional = true, AllowMultiple = true)] - public List Urls { get; set; } - - [SwitchArgument("AllowPartialMapping", false, Description = "Allow Partial Mapping (default set to false).", Optional = true)] - public bool AllowPartialMapping { get; set; } - - [SwitchArgument("StartAdminInterface", true, Description = "Start the AdminInterface (default set to true).", Optional = true)] - public bool StartAdminInterface { get; set; } - - [SwitchArgument("ReadStaticMappings", true, Description = "Read StaticMappings from ./__admin/mappings (default set to true).", Optional = true)] - public bool ReadStaticMappings { get; set; } - - [ValueArgument(typeof(string), "ProxyURL", Description = "The ProxyURL to use.", Optional = true)] - public string ProxyURL { get; set; } - - [SwitchArgument("SaveProxyMapping", true, Description = "Save the proxied request and response mapping files in ./__admin/mappings. (default set to true).", Optional = true)] - public bool SaveMapping { get; set; } - - [ValueArgument(typeof(string), "X509Certificate2", Description = "The X509Certificate2 Filename to use.", Optional = true)] - public string X509Certificate2Filename { get; set; } - } - - static void Main(string[] args) - { - var options = new Options(); - var parser = new CommandLineParser.CommandLineParser(); - parser.ExtractArgumentAttributes(options); - - try - { - parser.ParseCommandLine(args); - - if (!options.Urls.Any()) - { - options.Urls.Add("http://localhost:9090/"); - } - - var settings = new FluentMockServerSettings - { - Urls = options.Urls.ToArray(), - StartAdminInterface = options.StartAdminInterface, - ReadStaticMappings = options.ReadStaticMappings, - }; - - if (!string.IsNullOrEmpty(options.ProxyURL)) - { - settings.ProxyAndRecordSettings = new ProxyAndRecordSettings - { - Url = options.ProxyURL, - SaveMapping = options.SaveMapping, - X509Certificate2Filename = options.X509Certificate2Filename - }; - } - - var server = FluentMockServer.Start(settings); - if (options.AllowPartialMapping) - { - server.AllowPartialMapping(); - } - - Console.WriteLine("WireMock.Net server listening at {0}", string.Join(" and ", server.Urls)); - } - catch (CommandLineException e) - { - Console.WriteLine(e.Message); - parser.ShowUsage(); - } - - Console.WriteLine("Press any key to stop the server"); - Console.ReadKey(); - } - } -} \ No newline at end of file diff --git a/src/WireMock.Net.StandAlone/Program.cs b/src/WireMock.Net.StandAlone/StandAloneApp.cs similarity index 88% rename from src/WireMock.Net.StandAlone/Program.cs rename to src/WireMock.Net.StandAlone/StandAloneApp.cs index 8f0d5071..1100dc9a 100644 --- a/src/WireMock.Net.StandAlone/Program.cs +++ b/src/WireMock.Net.StandAlone/StandAloneApp.cs @@ -8,7 +8,10 @@ using WireMock.Settings; namespace WireMock.Net.StandAlone { - public class Program + /// + /// The StandAloneApp + /// + public static class StandAloneApp { private class Options { @@ -34,7 +37,11 @@ namespace WireMock.Net.StandAlone public string X509Certificate2Filename { get; set; } } - static void Main(params string[] args) + /// + /// Start WireMock.Net standalone bases on the commandline arguments. + /// + /// The commandline arguments + public static FluentMockServer Start(string[] args) { var options = new Options(); var parser = new CommandLineParser.CommandLineParser(); @@ -73,15 +80,16 @@ namespace WireMock.Net.StandAlone } Console.WriteLine("WireMock.Net server listening at {0}", string.Join(" and ", server.Urls)); + + return server; } catch (CommandLineException e) { Console.WriteLine(e.Message); parser.ShowUsage(); - } - Console.WriteLine("Press any key to stop the server"); - Console.ReadKey(); + throw; + } } } } \ No newline at end of file diff --git a/src/WireMock.Net.StandAlone/WireMock.Net.StandAlone.csproj b/src/WireMock.Net.StandAlone/WireMock.Net.StandAlone.csproj index e607885d..11fe0593 100644 --- a/src/WireMock.Net.StandAlone/WireMock.Net.StandAlone.csproj +++ b/src/WireMock.Net.StandAlone/WireMock.Net.StandAlone.csproj @@ -1,66 +1,37 @@ - - - + + - Debug - AnyCPU - {668F689E-57B4-422E-8846-C0FF643CA999} - Exe - Properties - WireMock.Net.StandAlone + Lightweight StandAlone Http Mocking Server for .Net. + WireMock.Net.StandAlone + 1.0.0.0 + Stef Heyenrath + net45;net452;net46;netstandard1.3 + true WireMock.Net.StandAlone - v4.5.2 - 512 - true - - - AnyCPU - true + WireMock.Net.StandAlone + tdd;mock;http;wiremock;test;server;unittest + Support for NETStandard by replacing HttpListener by Owin/Selfhosted + https://raw.githubusercontent.com/StefH/WireMock.Net/master/WireMock.Net-Logo.png + https://github.com/StefH/WireMock.Net + https://raw.githubusercontent.com/StefH/WireMock.Net/master/LICENSE + git + https://github.com/StefH/WireMock.Net + True full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 + ../../WireMock.Net-Logo.ico + WireMock.Net.StandAlone - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - ..\..\WireMock.Net-Logo.ico + + + NETSTANDARD + - - ..\..\packages\CommandLineArgumentsParser.3.0.10\lib\net45\CommandLineArgumentsParser.dll - - - ..\..\packages\Microsoft.Owin.Host.HttpListener.3.1.0\lib\net45\Microsoft.Owin.Host.HttpListener.dll - - - - - ..\..\src\WireMock.Net\bin\$(Configuration)\net45\WireMock.Net.dll - + + - - + - - - - - + \ No newline at end of file diff --git a/src/WireMock.Net.StandAlone/packages.config b/src/WireMock.Net.StandAlone/packages.config deleted file mode 100644 index b9c328e4..00000000 --- a/src/WireMock.Net.StandAlone/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/WireMock.Net/WireMock.Net.csproj b/src/WireMock.Net/WireMock.Net.csproj index a2d7a087..45895764 100644 --- a/src/WireMock.Net/WireMock.Net.csproj +++ b/src/WireMock.Net/WireMock.Net.csproj @@ -34,7 +34,7 @@ - +