Fix MappingMatcher in case of an exception in LinqMatcher. (#322)

* Fix MappingMatcher in case of an exception in LinqMatcher.

* update unit-tests
This commit is contained in:
Stef Heyenrath
2019-08-17 16:24:14 +00:00
committed by GitHub
parent 0a5c9880bd
commit 94f179ba17
8 changed files with 118 additions and 52 deletions

View File

@@ -11,7 +11,6 @@ using WireMock.Owin.Mappers;
using WireMock.Util;
using WireMock.Admin.Requests;
using WireMock.Logging;
using WireMock.Matchers.Request;
using WireMock.Matchers;
using System.Collections.Generic;
#if NET452
@@ -61,7 +60,7 @@ namespace WireMock.Net.Tests.Owin
_matcherMock = new Mock<IMappingMatcher>();
_matcherMock.SetupAllProperties();
_matcherMock.Setup(m => m.Match(It.IsAny<RequestMessage>())).Returns(((IMapping)null, (RequestMatchResult)null));
_matcherMock.Setup(m => m.FindBestMatch(It.IsAny<RequestMessage>())).Returns(new MappingMatcherResult());
_contextMock = new Mock<IContext>();
@@ -92,7 +91,7 @@ namespace WireMock.Net.Tests.Owin
_optionsMock.SetupGet(o => o.AuthorizationMatcher).Returns(new ExactMatcher());
_mappingMock.SetupGet(m => m.IsAdminInterface).Returns(true);
_matcherMock.Setup(m => m.Match(It.IsAny<RequestMessage>())).Returns((_mappingMock.Object, (RequestMatchResult)null));
_matcherMock.Setup(m => m.FindBestMatch(It.IsAny<RequestMessage>())).Returns(new MappingMatcherResult { Mapping = _mappingMock.Object });
// Act
await _sut.Invoke(_contextMock.Object);
@@ -113,7 +112,7 @@ namespace WireMock.Net.Tests.Owin
_optionsMock.SetupGet(o => o.AuthorizationMatcher).Returns(new ExactMatcher());
_mappingMock.SetupGet(m => m.IsAdminInterface).Returns(true);
_matcherMock.Setup(m => m.Match(It.IsAny<RequestMessage>())).Returns((_mappingMock.Object, (RequestMatchResult)null));
_matcherMock.Setup(m => m.FindBestMatch(It.IsAny<RequestMessage>())).Returns(new MappingMatcherResult { Mapping = _mappingMock.Object });
// Act
await _sut.Invoke(_contextMock.Object);