mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-21 07:51:23 +02:00
Small refactor on Template logic
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using HandlebarsDotNet;
|
using HandlebarsDotNet;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
using Stef.Validation;
|
||||||
using WireMock.Handlers;
|
using WireMock.Handlers;
|
||||||
|
|
||||||
namespace WireMock.Transformers.Handlebars
|
namespace WireMock.Transformers.Handlebars
|
||||||
@@ -12,7 +13,7 @@ namespace WireMock.Transformers.Handlebars
|
|||||||
|
|
||||||
public HandlebarsContextFactory([NotNull] IFileSystemHandler fileSystemHandler, [CanBeNull] Action<IHandlebars, IFileSystemHandler> action)
|
public HandlebarsContextFactory([NotNull] IFileSystemHandler fileSystemHandler, [CanBeNull] Action<IHandlebars, IFileSystemHandler> action)
|
||||||
{
|
{
|
||||||
_fileSystemHandler = fileSystemHandler ?? throw new ArgumentNullException(nameof(fileSystemHandler));
|
_fileSystemHandler = Guard.NotNull(fileSystemHandler);
|
||||||
_action = action;
|
_action = action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using System;
|
|
||||||
using Scriban;
|
using Scriban;
|
||||||
|
using Stef.Validation;
|
||||||
using WireMock.Handlers;
|
using WireMock.Handlers;
|
||||||
using WireMock.Types;
|
using WireMock.Types;
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ namespace WireMock.Transformers.Scriban
|
|||||||
|
|
||||||
public ScribanContext(IFileSystemHandler fileSystemHandler, TransformerType transformerType)
|
public ScribanContext(IFileSystemHandler fileSystemHandler, TransformerType transformerType)
|
||||||
{
|
{
|
||||||
FileSystemHandler = fileSystemHandler ?? throw new ArgumentNullException(nameof(fileSystemHandler));
|
FileSystemHandler = Guard.NotNull(fileSystemHandler);
|
||||||
_transformerType = transformerType;
|
_transformerType = transformerType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using WireMock.Handlers;
|
using WireMock.Handlers;
|
||||||
using WireMock.Types;
|
using WireMock.Types;
|
||||||
using Stef.Validation;
|
using Stef.Validation;
|
||||||
|
|
||||||
@@ -11,11 +11,8 @@ namespace WireMock.Transformers.Scriban
|
|||||||
|
|
||||||
public ScribanContextFactory(IFileSystemHandler fileSystemHandler, TransformerType transformerType)
|
public ScribanContextFactory(IFileSystemHandler fileSystemHandler, TransformerType transformerType)
|
||||||
{
|
{
|
||||||
Guard.NotNull(fileSystemHandler, nameof(fileSystemHandler));
|
_fileSystemHandler = Guard.NotNull(fileSystemHandler);
|
||||||
Guard.Condition(transformerType, t => t == TransformerType.Scriban || t == TransformerType.ScribanDotLiquid, nameof(transformerType));
|
_transformerType = Guard.Condition(transformerType, t => t == TransformerType.Scriban || t == TransformerType.ScribanDotLiquid);
|
||||||
|
|
||||||
_fileSystemHandler = fileSystemHandler;
|
|
||||||
_transformerType = transformerType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ITransformerContext Create()
|
public ITransformerContext Create()
|
||||||
|
|||||||
Reference in New Issue
Block a user