Refactor Transformer (add Scriban) (#562)

This commit is contained in:
Stef Heyenrath
2021-01-19 21:11:33 +01:00
committed by GitHub
parent 73e73cebb7
commit c35315e610
43 changed files with 1405 additions and 767 deletions

View File

@@ -0,0 +1,52 @@
using FluentAssertions;
using HandlebarsDotNet;
using Moq;
using System;
using WireMock.Handlers;
using WireMock.Transformers.Handlebars;
using Xunit;
namespace WireMock.Net.Tests.Transformers.Handlebars
{
public class HandlebarsContextFactoryTests
{
private readonly Mock<IFileSystemHandler> _fileSystemHandlerMock = new Mock<IFileSystemHandler>();
[Fact]
public void Create_WithNullAction_DoesNotInvokeAction()
{
// Arrange
var sut = new HandlebarsContextFactory(_fileSystemHandlerMock.Object, null);
// Act
var result = sut.Create();
// Assert
result.Should().NotBeNull();
}
[Fact]
public void Create_WithAction_InvokesAction()
{
// Arrange
int num = 0;
Action<IHandlebars, IFileSystemHandler> action = (ctx, fs) =>
{
ctx.Should().NotBeNull();
fs.Should().NotBeNull();
num++;
};
var sut = new HandlebarsContextFactory(_fileSystemHandlerMock.Object, action);
// Act
var result = sut.Create();
// Assert
result.Should().NotBeNull();
// Verify
num.Should().Be(1);
}
}
}