mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-31 14:43:40 +02:00
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using NFluent;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using System;
|
||||
using WireMock.Handlers;
|
||||
using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseBuilders;
|
||||
using WireMock.Serialization;
|
||||
@@ -9,19 +11,41 @@ namespace WireMock.Net.Tests.Serialization
|
||||
{
|
||||
public class MappingConverterTests
|
||||
{
|
||||
private readonly Mock<IFileSystemHandler> _fileSystemHandlerMock = new Mock<IFileSystemHandler>();
|
||||
|
||||
[Fact]
|
||||
public void MappingConverter_ToMappingModel()
|
||||
public void ToMappingModel()
|
||||
{
|
||||
// Assign
|
||||
var request = Request.Create();
|
||||
var response = Response.Create();
|
||||
var mapping = new Mapping(Guid.NewGuid(), "", null, request, response, 0, null, null, null);
|
||||
var mapping = new Mapping(Guid.NewGuid(), "", null, _fileSystemHandlerMock.Object, request, response, 0, null, null, null);
|
||||
|
||||
// Act
|
||||
var model = MappingConverter.ToMappingModel(mapping);
|
||||
|
||||
// Assert
|
||||
Check.That(model).IsNotNull();
|
||||
model.Should().NotBeNull();
|
||||
model.Priority.Should().BeNull();
|
||||
model.Response.BodyAsJsonIndented.Should().BeNull();
|
||||
model.Response.UseTransformer.Should().BeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToMappingModel_WithPriority_ReturnsPriority()
|
||||
{
|
||||
// Assign
|
||||
var request = Request.Create();
|
||||
var response = Response.Create().WithBodyAsJson(new { x = "x" }).WithTransformer();
|
||||
var mapping = new Mapping(Guid.NewGuid(), "", null, _fileSystemHandlerMock.Object, request, response, 42, null, null, null);
|
||||
|
||||
// Act
|
||||
var model = MappingConverter.ToMappingModel(mapping);
|
||||
|
||||
// Assert
|
||||
model.Should().NotBeNull();
|
||||
model.Priority.Should().Be(42);
|
||||
model.Response.UseTransformer.Should().BeTrue();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user