Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
StefH committed Aug 27, 2022
1 parent 75d1dd8 commit 6179f0d
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 68 deletions.
21 changes: 10 additions & 11 deletions examples/WireMock.Net.Console.NETCoreApp/Program.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
using System.IO;
using System.IO;
using System.Reflection;
using log4net;
using log4net.Config;
using log4net.Repository;
using WireMock.Net.ConsoleApplication;

namespace WireMock.Net.Console.NETCoreApp
namespace WireMock.Net.Console.NETCoreApp;

static class Program
{
static class Program
{
private static readonly ILoggerRepository LogRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());
private static readonly ILog Log = LogManager.GetLogger(typeof(Program));
private static readonly ILoggerRepository LogRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());
private static readonly ILog Log = LogManager.GetLogger(typeof(Program));

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

MainApp.Run();
}
MainApp.Run();
}
}
15 changes: 7 additions & 8 deletions examples/WireMock.Net.Console.Net452.Classic/Program.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
using System.IO;
using System.IO;
using log4net.Config;

namespace WireMock.Net.ConsoleApplication
namespace WireMock.Net.ConsoleApplication;

static class Program
{
static class Program
static void Main(params string[] args)
{
static void Main(params string[] args)
{
XmlConfigurator.Configure(new FileInfo("log4net.config"));
XmlConfigurator.Configure(new FileInfo("log4net.config"));

MainApp.Run();
}
MainApp.Run();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="libman.json" />
<None Include="log4net.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
47 changes: 23 additions & 24 deletions examples/WireMock.Net.StandAlone.Net452/Program.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
using System;
using System.IO;
using System.Linq;
using log4net.Config;
using WireMock.Server;
using WireMock.Settings;

namespace WireMock.Net.StandAlone.Net452
{
public class Program
{
static void Main(params string[] args)
{
XmlConfigurator.Configure(new FileInfo("log4net.config"));

if (WireMockServerSettingsParser.TryParseArguments(args, out var settings))
{
settings.Logger.Debug("WireMock.Net server arguments [{0}]", string.Join(", ", args.Select(a => $"'{a}'")));
using System;
using System.IO;
using System.Linq;
using log4net.Config;
using WireMock.Server;
using WireMock.Settings;

WireMockServer.Start(settings);
namespace WireMock.Net.StandAlone.Net452;

Console.WriteLine("Press any key to stop the server");
Console.ReadKey();
}
}
}
public class Program
{
static void Main(params string[] args)
{
XmlConfigurator.Configure(new FileInfo("log4net.config"));

if (WireMockServerSettingsParser.TryParseArguments(args, out var settings))
{
Console.WriteLine("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();
}
}
}
39 changes: 19 additions & 20 deletions examples/WireMock.Net.StandAlone.Net461/Program.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
using System;
using System.Linq;
using WireMock.Server;
using WireMock.Settings;

namespace WireMock.Net.StandAlone.Net461
{
static class Program
{
static void Main(string[] args)
{
if (WireMockServerSettingsParser.TryParseArguments(args, out var settings))
{
settings.Logger.Debug("WireMock.Net server arguments [{0}]", string.Join(", ", args.Select(a => $"'{a}'")));
using System;
using System.Linq;
using WireMock.Server;
using WireMock.Settings;

WireMockServer.Start(settings);
namespace WireMock.Net.StandAlone.Net461;

Console.WriteLine("Press any key to stop the server");
Console.ReadKey();
}
}
}
static class Program
{
static void Main(string[] args)
{
if (WireMockServerSettingsParser.TryParseArguments(args, out var settings))
{
Console.WriteLine("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();
}
}
}
2 changes: 1 addition & 1 deletion src/WireMock.Net/Owin/IWireMockMiddlewareOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
using WireMock.Logging;
using WireMock.Matchers;
using WireMock.Util;
using WireMock.Types;
#if !USE_ASPNETCORE
using Owin;
#else
using IAppBuilder = Microsoft.AspNetCore.Builder.IApplicationBuilder;
using Microsoft.Extensions.DependencyInjection;
using WireMock.Types;
#endif

namespace WireMock.Owin;
Expand Down
5 changes: 2 additions & 3 deletions src/WireMock.Net/Settings/WireMockServerSettingsParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static class WireMockServerSettingsParser
[PublicAPI]
public static bool TryParseArguments(string[] args, [NotNullWhen(true)] out WireMockServerSettings? settings, IWireMockLogger? logger = null)
{
Guard.HasNoNulls(args, nameof(args));
Guard.HasNoNulls(args);

var parser = new SimpleCommandLineParser();
parser.Parse(args);
Expand Down Expand Up @@ -68,8 +68,7 @@ public static bool TryParseArguments(string[] args, [NotNullWhen(true)] out Wire
{
settings.Logger = logger;
}

if (parser.GetStringValue("WireMockLogger") == "WireMockConsoleLogger")
else if (parser.GetStringValue("WireMockLogger") == "WireMockConsoleLogger")
{
settings.Logger = new WireMockConsoleLogger();
}
Expand Down

0 comments on commit 6179f0d

Please sign in to comment.