mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-25 19:02:24 +01:00
* Lower priority from Proxy mappings * Fix codefactor * extra tests * #205 * Fix test for linux * `c:\temp\x.json` fix * Extra tests * more tests * more tests * codefactor * #200 * refactor * refactor * tests
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using System.Linq;
|
||||
using NFluent;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Owin;
|
||||
using WireMock.Server;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests
|
||||
{
|
||||
public class FluentMockServerAuthenticationTests
|
||||
{
|
||||
[Fact]
|
||||
public void FluentMockServer_Authentication_SetBasicAuthentication()
|
||||
{
|
||||
// Assign
|
||||
var server = FluentMockServer.Start();
|
||||
|
||||
// Act
|
||||
server.SetBasicAuthentication("x", "y");
|
||||
|
||||
// Assert
|
||||
var options = server.GetPrivateFieldValue<WireMockMiddlewareOptions>("_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 FluentMockServer_Authentication_RemoveBasicAuthentication()
|
||||
{
|
||||
// Assign
|
||||
var server = FluentMockServer.Start();
|
||||
server.SetBasicAuthentication("x", "y");
|
||||
|
||||
// Act
|
||||
server.RemoveBasicAuthentication();
|
||||
|
||||
// Assert
|
||||
var options = server.GetPrivateFieldValue<WireMockMiddlewareOptions>("_options");
|
||||
Check.That(options.AuthorizationMatcher).IsNull();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user