Update BodyParser logic (#212)

* Update BodyParser logic

* update logic for byte[]

* small update

* MyGetKey

* myget

* dotnet nuget push

* dotnet build

* Release

* .

* StringContent

* 1.0.4.18-preview-02

* Debug

* 1.0.4.18-preview-02

* disable some proxy tests

* myget

* packagesToPack

* fix

* <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>     <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>

* Release

* <VersionPrefix>1.0.4.18</VersionPrefix>

* fix

* BodyParserTests

* ResponseBodyData (#216)

* ResponseBodyData

* refactor tests

* LogEntryMapperTests
This commit is contained in:
Stef Heyenrath
2018-10-25 14:08:24 +02:00
committed by GitHub
parent d9ed1bf812
commit 1af512fc72
66 changed files with 1186 additions and 823 deletions

View File

@@ -96,7 +96,7 @@ namespace WireMock.Net.Tests.Owin.Mappers
var responseMessage = new ResponseMessage
{
Headers = new Dictionary<string, WireMockList<string>>(),
Body = body
BodyData = new BodyData { DetectedBodyType = BodyType.String, BodyAsString = body }
};
// Act
@@ -114,7 +114,7 @@ namespace WireMock.Net.Tests.Owin.Mappers
var responseMessage = new ResponseMessage
{
Headers = new Dictionary<string, WireMockList<string>>(),
BodyAsBytes = bytes
BodyData = new BodyData { DetectedBodyType = BodyType.Bytes, BodyAsBytes = bytes }
};
// Act
@@ -128,11 +128,11 @@ namespace WireMock.Net.Tests.Owin.Mappers
public async void OwinResponseMapper_MapAsync_BodyAsJson()
{
// Assign
var json = new { t = "x", i = (string)null };
var responseMessage = new ResponseMessage
{
Headers = new Dictionary<string, WireMockList<string>>(),
BodyAsJson = new { t = "x", i = (string)null },
BodyAsJsonIndented = false
BodyData = new BodyData { DetectedBodyType = BodyType.Json, BodyAsJson = json, BodyAsJsonIndented = false }
};
// Act

View File

@@ -21,7 +21,7 @@ namespace WireMock.Net.Tests.Owin
_optionsMock = new Mock<IWireMockMiddlewareOptions>();
_optionsMock.SetupAllProperties();
_optionsMock.Setup(o => o.Mappings).Returns(new ConcurrentDictionary<Guid, IMapping>());
_optionsMock.Setup(o => o.LogEntries).Returns(new ConcurentObservableCollection<LogEntry>());
_optionsMock.Setup(o => o.LogEntries).Returns(new ConcurrentObservableCollection<LogEntry>());
_optionsMock.Setup(o => o.Scenarios).Returns(new ConcurrentDictionary<string, ScenarioState>());
_sut = new MappingMatcher(_optionsMock.Object);

View File

@@ -44,7 +44,7 @@ namespace WireMock.Net.Tests.Owin
_optionsMock = new Mock<IWireMockMiddlewareOptions>();
_optionsMock.SetupAllProperties();
_optionsMock.Setup(o => o.Mappings).Returns(new ConcurrentDictionary<Guid, IMapping>());
_optionsMock.Setup(o => o.LogEntries).Returns(new ConcurentObservableCollection<LogEntry>());
_optionsMock.Setup(o => o.LogEntries).Returns(new ConcurrentObservableCollection<LogEntry>());
_optionsMock.Setup(o => o.Scenarios).Returns(new ConcurrentDictionary<string, ScenarioState>());
_optionsMock.Setup(o => o.Logger.Warn(It.IsAny<string>(), It.IsAny<object[]>()));
_optionsMock.Setup(o => o.Logger.Error(It.IsAny<string>(), It.IsAny<object[]>()));
@@ -79,7 +79,7 @@ namespace WireMock.Net.Tests.Owin
// Assert and Verify
_optionsMock.Verify(o => o.Logger.Warn(It.IsAny<string>(), It.IsAny<object[]>()), Times.Once);
Expression<Func<ResponseMessage, bool>> match = r => r.StatusCode == 404 && ((StatusModel)r.BodyAsJson).Status == "No matching mapping found";
Expression<Func<ResponseMessage, bool>> match = r => r.StatusCode == 404 && ((StatusModel)r.BodyData.BodyAsJson).Status == "No matching mapping found";
_responseMapperMock.Verify(m => m.MapAsync(It.Is(match), It.IsAny<IResponse>()), Times.Once);
}