Files
WireMock.Net/test/WireMock.Net.Tests/Transformers/Handlebars/HandlebarsContextFactoryTests.cs
Stef Heyenrath 54edf0bebc Add link to TIOBE Index on main page + fix issues (#1137)
* Add TIOBE + include SonarAnalyzer.CSharp

* .

* cp

* Copyright © WireMock.Net

* more fixes

* fix

* xpath

* if (Matchers == null || !Matchers.Any())

* if (Matchers != null)

* ?

* .

* .
2024-07-18 18:06:04 +02:00

61 lines
1.4 KiB
C#

// Copyright © WireMock.Net
using FluentAssertions;
using Moq;
using WireMock.Handlers;
using WireMock.Settings;
using WireMock.Transformers.Handlebars;
using Xunit;
namespace WireMock.Net.Tests.Transformers.Handlebars;
public class HandlebarsContextFactoryTests
{
private readonly Mock<IFileSystemHandler> _fileSystemHandlerMock = new();
[Fact]
public void Create_WithNullAction_DoesNotInvokeAction()
{
// Arrange
var settings = new WireMockServerSettings
{
FileSystemHandler = _fileSystemHandlerMock.Object
};
var sut = new HandlebarsContextFactory(settings);
// Act
var result = sut.Create();
// Assert
result.Should().NotBeNull();
}
[Fact]
public void Create_WithAction_InvokesAction()
{
// Arrange
int num = 0;
var settings = new WireMockServerSettings
{
FileSystemHandler = _fileSystemHandlerMock.Object,
HandlebarsRegistrationCallback = (ctx, fs) =>
{
ctx.Should().NotBeNull();
fs.Should().NotBeNull();
num++;
}
};
var sut = new HandlebarsContextFactory(settings);
// Act
var result = sut.Create();
// Assert
result.Should().NotBeNull();
// Verify
num.Should().Be(1);
}
}