Skip to content

Commit

Permalink
WireMock.Net version 1.1.x (#363)
Browse files Browse the repository at this point in the history
* refactor

* rename api

* -preview-01

* logger

* move

* RandomDataGenerator.Net

* .

* ISettings

* renames...

* refactor CommandlineParser logic

* remove standalone

* Remove Interfaces

* Update tests

* WireMock.Net.StandAlone

* .

* fix

* .

* _settings

* Admin

* WireMock.Net.Abstractions

* fix build

* rename WireMockServer

* fix compile errors
  • Loading branch information
StefH committed Dec 27, 2019
1 parent 368f0e1 commit d971144
Show file tree
Hide file tree
Showing 141 changed files with 2,549 additions and 2,319 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</PropertyGroup>

<PropertyGroup>
<VersionPrefix>1.0.43</VersionPrefix>
<VersionPrefix>1.1.0-preview-01</VersionPrefix>
</PropertyGroup>

<Choose>
Expand Down
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ A C# .NET version based on [mock4net](https://github.com/alexvictoor/mock4net) w
| &nbsp;&nbsp;**Sonar Coverage** | [![Sonar Coverage](https://sonarcloud.io/api/project_badges/measure?project=wiremock&metric=coverage)](https://sonarcloud.io/component_measures?id=wiremock&metric=coverage) |
| &nbsp;&nbsp;**Codecov** | [![codecov](https://codecov.io/gh/WireMock-Net/WireMock.Net/branch/master/graph/badge.svg)](https://codecov.io/gh/WireMock-Net/WireMock.Net) |
| &nbsp;&nbsp;**Coveralls** | [![Coverage Status](https://coveralls.io/repos/github/WireMock-Net/WireMock.Net/badge.svg?branch=master)](https://coveralls.io/github/WireMock-Net/WireMock.Net?branch=master) |
| |
| ***NuGet*** | &nbsp; |
| &nbsp;&nbsp;**WireMock.Net** | [![NuGet Badge WireMock.Net](https://buildstats.info/nuget/WireMock.Net)](https://www.nuget.org/packages/WireMock.Net) |
| &nbsp;&nbsp;**WireMock.Net.StandAlone** | [![NuGet Badge WireMock.Net.StandAlone](https://buildstats.info/nuget/WireMock.Net.StandAlone)](https://www.nuget.org/packages/WireMock.Net.StandAlone) |
| ***MyGet (previews)*** | &nbsp; |
| &nbsp;&nbsp;**WireMock.Net** | [![MyGet Badge WireMock.Net](https://buildstats.info/myget/wiremock-net/WireMock.Net)](https://www.myget.org/feed/wiremock-net/package/nuget/WireMock.Net) |
| &nbsp;&nbsp;**WireMock.Net.StandAlone** | [![MyGet Badge WireMock.Net.StandAlone](https://buildstats.info/myget/wiremock-net/WireMock.Net.StandAlone)](https://www.myget.org/feed/wiremock-net/package/nuget/WireMock.Net.StandAlone) |

### NuGet packages

| | Official | Preview |
| - | - | - |
| &nbsp;&nbsp;**WireMock.Net** | [![NuGet Badge WireMock.Net](https://buildstats.info/nuget/WireMock.Net)](https://www.nuget.org/packages/WireMock.Net) | [![MyGet Badge WireMock.Net](https://buildstats.info/myget/wiremock-net/WireMock.Net)](https://www.myget.org/feed/wiremock-net/package/nuget/WireMock.Net)
| &nbsp;&nbsp;**WireMock.Net.StandAlone** | [![NuGet Badge WireMock.Net](https://buildstats.info/nuget/WireMock.Net.StandAlone)](https://www.nuget.org/packages/WireMock.Net.StandAlone) | [![MyGet Badge WireMock.Net.StandAlone](https://buildstats.info/myget/wiremock-net/WireMock.Net.StandAlone)](https://www.myget.org/feed/wiremock-net/package/nuget/WireMock.Net.StandAlone)
| &nbsp;&nbsp;**WireMock.Net.RestClient** | [![NuGet Badge WireMock.Net.RestClient](https://buildstats.info/nuget/WireMock.Net.RestClient)](https://www.nuget.org/packages/WireMock.Net.RestClient) | [![MyGet Badge WireMock.Net.RestClient](https://buildstats.info/myget/wiremock-net/WireMock.Net.RestClient)](https://www.myget.org/feed/wiremock-net/package/nuget/WireMock.Net.RestClient)

## Development
For the supported frameworks and build information, see [this](https://github.com/WireMock-Net/WireMock.Net/wiki/Development-Information) page.
Expand Down
115 changes: 102 additions & 13 deletions WireMock.Net Solution.sln

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/WireMock.Net.Client/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class Program
{
static async Task Main(string[] args)
{
// Create an implementation of the IFluentMockServerAdmin and pass in the base URL for the API.
var api = RestClient.For<IFluentMockServerAdmin>("http://localhost:9091");
// Create an implementation of the IWireMockAdminApi and pass in the base URL for the API.
var api = RestClient.For<IWireMockAdminApi>("http://localhost:9091");

// Set BASIC Auth
var value = Convert.ToBase64String(Encoding.ASCII.GetBytes("a:b"));
Expand Down
4 changes: 3 additions & 1 deletion examples/WireMock.Net.Client/WireMock.Net.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="RestEase" Version="1.4.7" />
<PackageReference Include="RestEase" Version="1.4.10" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\WireMock.Net.Abstractions\WireMock.Net.Abstractions.csproj" />
<ProjectReference Include="..\..\src\WireMock.Net.RestClient\WireMock.Net.RestClient.csproj" />
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
</Content>
</ItemGroup>

<ItemGroup>
<Compile Remove="__admin\mappings\1.cs" />
</ItemGroup>

<ItemGroup>
<None Remove="__admin\mappings\array.json" />
</ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions examples/WireMock.Net.Console.Net452.Classic/MainApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static void Run()
string url2 = "http://localhost:9092/";
string url3 = "https://localhost:9443/";

var server = FluentMockServer.Start(new FluentMockServerSettings
var server = WireMockServer.Start(new WireMockServerSettings
{
AllowCSharpCodeMatcher = true,
Urls = new[] { url1, url2, url3 },
Expand All @@ -64,7 +64,7 @@ public static void Run()
// Uncomment below if you want to use the CustomFileSystemFileHandler
// FileSystemHandler = new CustomFileSystemFileHandler()
});
System.Console.WriteLine("FluentMockServer listening at {0}", string.Join(",", server.Urls));
System.Console.WriteLine("WireMockServer listening at {0}", string.Join(",", server.Urls));

server.SetBasicAuthentication("a", "b");

Expand Down Expand Up @@ -468,6 +468,7 @@ public static void Run()
DateTimeNowToString = DateTime.Now.ToString("s", CultureInfo.InvariantCulture),
Guid1 = "{{Random Type=\"Guid\" Uppercase=false}}",
Guid2 = "{{Random Type=\"Guid\"}}",
Guid3 = "{{Random Type=\"Guid\" Format=\"X\"}}",
Boolean = "{{Random Type=\"Boolean\"}}",
Integer = "{{Random Type=\"Integer\" Min=1000 Max=9999}}",
Long = "{{#Random Type=\"Long\" Min=10000000 Max=99999999}}{{this}}{{/Random}}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\WireMock.Net.StandAlone\WireMock.Net.StandAlone.csproj">
<Project>{b6269aac-170a-43d5-8b9a-579ded3d9a95}</Project>
<Name>WireMock.Net.StandAlone</Name>
<ProjectReference Include="..\..\src\WireMock.Net.Abstractions\WireMock.Net.Abstractions.csproj">
<Project>{b6269aac-170a-4346-8b9a-579ded3d9a94}</Project>
<Name>WireMock.Net.Abstractions</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj">
<Project>{d3804228-91f4-4502-9595-39584e5a01ad}</Project>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\WireMock.Net.StandAlone\WireMock.Net.StandAlone.csproj">
<Project>{b6269aac-170a-43d5-8b9a-579ded3d9a95}</Project>
<Name>WireMock.Net.StandAlone</Name>
<ProjectReference Include="..\..\src\WireMock.Net.Abstractions\WireMock.Net.Abstractions.csproj">
<Project>{b6269aac-170a-4346-8b9a-579ded3d9a94}</Project>
<Name>WireMock.Net.Abstractions</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj">
<Project>{d3804228-91f4-4502-9595-39584e5a01ad}</Project>
Expand Down
4 changes: 2 additions & 2 deletions examples/WireMock.Net.Console.Proxy.NETCoreApp2/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ static void Main(string[] args)
RunTestDifferentPort().Wait(20000); // prints "1"
RunTestDifferentPort().Wait(20000); // prints "1"

var server = FluentMockServer.Start(new FluentMockServerSettings
var server = WireMockServer.Start(new WireMockServerSettings
{
Urls = new[] { "http://localhost:9091", "https://localhost:9443" },
StartAdminInterface = true,
Expand All @@ -44,7 +44,7 @@ static void Main(string[] args)

private static async Task RunTestDifferentPort()
{
var server = FluentMockServer.Start();
var server = WireMockServer.Start();

server.Given(Request.Create().WithPath("/").UsingGet())
.RespondWith(Response.Create().WithStatusCode(200).WithBody("Hello"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\WireMock.Net.StandAlone\WireMock.Net.StandAlone.csproj" />
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion examples/WireMock.Net.Console.Proxy.Net452/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Program
static void Main(string[] args)
{
string[] urls = { "http://localhost:9091/", "https://localhost:9443/" };
var server = FluentMockServer.Start(new FluentMockServerSettings
var server = WireMockServer.Start(new WireMockServerSettings
{
Urls = urls,
StartAdminInterface = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\WireMock.Net.StandAlone\WireMock.Net.StandAlone.csproj">
<Project>{b6269aac-170a-43d5-8b9a-579ded3d9a95}</Project>
<Name>WireMock.Net.StandAlone</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj">
<Project>{d3804228-91f4-4502-9595-39584e5a01ad}</Project>
<Name>WireMock.Net</Name>
Expand Down
2 changes: 1 addition & 1 deletion examples/WireMock.Net.Console.Record.NETCoreApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ static class Program
{
static void Main(params string[] args)
{
var server = FluentMockServer.Start(new FluentMockServerSettings
var server = WireMockServer.Start(new WireMockServerSettings
{
Urls = new[] { "http://localhost:9091/", "https://localhost:9443/" },
StartAdminInterface = true,
Expand Down
7 changes: 3 additions & 4 deletions examples/WireMock.Net.Service/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.IO;
using System.ServiceProcess;
using WireMock.Net.Service;
using WireMock.Net.StandAlone;
using WireMock.Server;
using WireMock.Settings;

Expand All @@ -12,7 +11,7 @@ namespace Wiremock.Net.Service
public static class Program
{
#region Nested classes to support running as service
public const string ServiceName = "Wiremock.Net.Service";
public const string ServiceName = "WireMock.Net.Service";

public class Service : ServiceBase
{
Expand All @@ -33,7 +32,7 @@ protected override void OnStop()
}
#endregion

private static FluentMockServer _server;
private static WireMockServer _server;

static void Main(string[] args)
{
Expand Down Expand Up @@ -64,7 +63,7 @@ static void Main(string[] args)

private static void Start()
{
_server = StandAloneApp.Start(new FluentMockServerSettings
_server = WireMockServer.Start(new WireMockServerSettings
{
Urls = new[] { "http://*:9091/" },
StartAdminInterface = true,
Expand Down
10 changes: 5 additions & 5 deletions examples/WireMock.Net.Service/WireMock.Net.Service.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
<HintPath>..\..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="RestEase, Version=1.4.7.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\RestEase.1.4.7\lib\net45\RestEase.dll</HintPath>
<Reference Include="RestEase, Version=1.4.10.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\RestEase.1.4.10\lib\net45\RestEase.dll</HintPath>
</Reference>
<Reference Include="SimMetrics.Net, Version=1.0.5.0, Culture=neutral, PublicKeyToken=c58dc06d59f3391b, processorArchitecture=MSIL">
<HintPath>..\..\packages\SimMetrics.Net.1.0.5\lib\net45\SimMetrics.Net.dll</HintPath>
Expand Down Expand Up @@ -121,9 +121,9 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\WireMock.Net.StandAlone\WireMock.Net.StandAlone.csproj">
<Project>{b6269aac-170a-43d5-8b9a-579ded3d9a95}</Project>
<Name>WireMock.Net.StandAlone</Name>
<ProjectReference Include="..\..\src\WireMock.Net.Abstractions\WireMock.Net.Abstractions.csproj">
<Project>{b6269aac-170a-4346-8b9a-579ded3d9a94}</Project>
<Name>WireMock.Net.Abstractions</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj">
<Project>{d3804228-91f4-4502-9595-39584e5a01ad}</Project>
Expand Down
2 changes: 1 addition & 1 deletion examples/WireMock.Net.Service/WireMockLog4NetLogger.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using log4net;
using Newtonsoft.Json;
using Wiremock.Net.Service;
using WireMock.Admin.Requests;
using WireMock.Logging;
using WireMock.Models.Requests;

namespace WireMock.Net.Service
{
Expand Down
2 changes: 1 addition & 1 deletion examples/WireMock.Net.Service/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<package id="MimeKitLite" version="2.0.1" targetFramework="net452" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net452" />
<package id="Owin" version="1.0" targetFramework="net452" />
<package id="RestEase" version="1.4.7" targetFramework="net452" />
<package id="RestEase" version="1.4.10" targetFramework="net452" />
<package id="SimMetrics.Net" version="1.0.5" targetFramework="net452" />
<package id="System.Net.Http" version="4.3.3" targetFramework="net452" />
<package id="XPath2" version="1.0.6.1" targetFramework="net452" />
Expand Down
9 changes: 7 additions & 2 deletions examples/WireMock.Net.StandAlone.NETCoreApp/Program.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using log4net;
using log4net.Config;
using log4net.Repository;
using WireMock.Server;
using WireMock.Settings;

namespace WireMock.Net.StandAlone.NETCoreApp
{
Expand All @@ -15,13 +17,16 @@ static class Program
// private static readonly ILog Log = LogManager.GetLogger(typeof(Program));

private static int sleepTime = 30000;
private static FluentMockServer _server;
private static WireMockServer _server;

static void Main(string[] args)
{
XmlConfigurator.Configure(LogRepository, new FileInfo("log4net.config"));

_server = StandAloneApp.Start(args, new WireMockLog4NetLogger());
var settings = WireMockServerSettingsParser.ParseArguments(args, new WireMockLog4NetLogger());
settings.Logger.Debug("WireMock.Net server arguments [{0}]", string.Join(", ", args.Select(a => $"'{a}'")));

_server = WireMockServer.Start(settings);

Console.WriteLine($"{DateTime.UtcNow} Press Ctrl+C to shut down");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\WireMock.Net.StandAlone\WireMock.Net.StandAlone.csproj" />
<ProjectReference Include="..\..\src\WireMock.Net.Abstractions\WireMock.Net.Abstractions.csproj" />
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using log4net;
using Newtonsoft.Json;
using WireMock.Admin.Requests;
using WireMock.Logging;
using WireMock.Models.Requests;

namespace WireMock.Net.StandAlone.NETCoreApp
{
Expand Down
8 changes: 7 additions & 1 deletion examples/WireMock.Net.StandAlone.Net452/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using System.IO;
using System.Linq;
using log4net.Config;
using WireMock.Server;
using WireMock.Settings;

namespace WireMock.Net.StandAlone.Net452
{
Expand All @@ -10,7 +13,10 @@ static void Main(params string[] args)
{
XmlConfigurator.Configure(new FileInfo("log4net.config"));

StandAloneApp.Start(args);
var settings = WireMockServerSettingsParser.ParseArguments(args);
settings.Logger.Debug("WireMock.Net server arguments [{0}]", string.Join(", ", args.Select(a => $"'{a}'")));

WireMockServer.Start(settings);

Console.WriteLine("Press any key to stop the server");
Console.ReadKey();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\WireMock.Net.StandAlone\WireMock.Net.StandAlone.csproj">
<Project>{b6269aac-170a-43d5-8b9a-579ded3d9a95}</Project>
<Name>WireMock.Net.StandAlone</Name>
<ProjectReference Include="..\..\src\WireMock.Net.Abstractions\WireMock.Net.Abstractions.csproj">
<Project>{b6269aac-170a-4346-8b9a-579ded3d9a94}</Project>
<Name>WireMock.Net.Abstractions</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj">
<Project>{d3804228-91f4-4502-9595-39584e5a01ad}</Project>
Expand Down
12 changes: 7 additions & 5 deletions examples/WireMock.Net.StandAlone.Net461/Program.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
using System;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using System.Linq;
using WireMock.Server;
using WireMock.Settings;

namespace WireMock.Net.StandAlone.Net461
{
static class Program
{
static void Main(string[] args)
{
var server = StandAloneApp.Start(args);
server.Given(Request.Create())
.RespondWith(Response.Create().WithProxy("http://10.10.66.65"));
var settings = WireMockServerSettingsParser.ParseArguments(args);
settings.Logger.Debug("WireMock.Net server arguments [{0}]", string.Join(", ", args.Select(a => $"'{a}'")));

WireMockServer.Start(settings);

Console.WriteLine("Press any key to stop the server");
Console.ReadKey();
Expand Down
Loading

0 comments on commit d971144

Please sign in to comment.