WireMock.Net version 1.1.x (#363)

* 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
This commit is contained in:
Stef Heyenrath
2019-12-27 16:01:13 +01:00
committed by GitHub
parent 368f0e13ac
commit d971144426
141 changed files with 2550 additions and 2320 deletions

View File

@@ -0,0 +1,42 @@
using NFluent;
using WireMock.Matchers;
using WireMock.Owin;
using WireMock.Server;
using Xunit;
namespace WireMock.Net.Tests
{
public class WireMockServerAuthenticationTests
{
[Fact]
public void WireMockServer_Authentication_SetBasicAuthentication()
{
// Assign
var server = WireMockServer.Start();
// Act
server.SetBasicAuthentication("x", "y");
// Assert
var options = server.GetPrivateFieldValue<IWireMockMiddlewareOptions>("_options");
Check.That(options.AuthorizationMatcher.Name).IsEqualTo("RegexMatcher");
Check.That(options.AuthorizationMatcher.MatchBehaviour).IsEqualTo(MatchBehaviour.AcceptOnMatch);
Check.That(options.AuthorizationMatcher.GetPatterns()).ContainsExactly("^(?i)BASIC eDp5$");
}
[Fact]
public void WireMockServer_Authentication_RemoveBasicAuthentication()
{
// Assign
var server = WireMockServer.Start();
server.SetBasicAuthentication("x", "y");
// Act
server.RemoveBasicAuthentication();
// Assert
var options = server.GetPrivateFieldValue<IWireMockMiddlewareOptions>("_options");
Check.That(options.AuthorizationMatcher).IsNull();
}
}
}