mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-21 00:28:59 +01:00
36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using HandlebarsDotNet;
|
|
using HandlebarsDotNet.Helpers;
|
|
using HandlebarsDotNet.Helpers.Helpers;
|
|
using WireMock.Handlers;
|
|
|
|
namespace WireMock.Transformers.Handlebars
|
|
{
|
|
internal static class WireMockHandlebarsHelpers
|
|
{
|
|
public static void Register(IHandlebars handlebarsContext, IFileSystemHandler fileSystemHandler)
|
|
{
|
|
// Register https://github.com/StefH/Handlebars.Net.Helpers
|
|
HandlebarsHelpers.Register(handlebarsContext, o =>
|
|
{
|
|
o.CustomHelperPaths = new string[]
|
|
{
|
|
Directory.GetCurrentDirectory()
|
|
#if !NETSTANDARD1_3
|
|
, Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
|
|
#endif
|
|
}
|
|
.Distinct()
|
|
.ToList();
|
|
|
|
o.CustomHelpers = new Dictionary<string, IHelpers>
|
|
{
|
|
{ "File", new FileHelpers(handlebarsContext, fileSystemHandler) }
|
|
};
|
|
});
|
|
}
|
|
}
|
|
} |