Handlebars Extension (#286)

* wip

* HandlebarsRegistrationCallback

* HandlebarsContextFactoryTests

* 1.0.21.0

* fix sonar

* LocalFileSystemHandler

* readme

* Fix System.IO.IOException
This commit is contained in:
Stef Heyenrath
2019-07-03 18:37:22 +02:00
committed by GitHub
parent 653e03fcd9
commit 93682c9bbf
37 changed files with 366 additions and 208 deletions

View File

@@ -0,0 +1,52 @@
using FluentAssertions;
using HandlebarsDotNet;
using Moq;
using System;
using WireMock.Handlers;
using WireMock.Transformers;
using Xunit;
namespace WireMock.Net.Tests.Transformers
{
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);
}
}
}