mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-18 07:00:04 +02:00
Handlebars Extension (#286)
* wip * HandlebarsRegistrationCallback * HandlebarsContextFactoryTests * 1.0.21.0 * fix sonar * LocalFileSystemHandler * readme * Fix System.IO.IOException
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user