diff --git a/src/WireMock.Net/Transformers/Scriban/WireMockListAccessor.cs b/src/WireMock.Net/Transformers/Scriban/WireMockListAccessor.cs index 08af878e..2fdd4a39 100644 --- a/src/WireMock.Net/Transformers/Scriban/WireMockListAccessor.cs +++ b/src/WireMock.Net/Transformers/Scriban/WireMockListAccessor.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using Scriban; using Scriban.Parsing; @@ -50,6 +50,20 @@ namespace WireMock.Transformers.Scriban { throw new NotImplementedException(); } + + public bool TryGetItem(TemplateContext context, SourceSpan span, object target, object index, out object value) + { + throw new NotImplementedException(); + } + + public bool TrySetItem(TemplateContext context, SourceSpan span, object target, object index, object value) + { + throw new NotImplementedException(); + } + + public bool HasIndexer => throw new NotImplementedException(); + + public Type IndexType => throw new NotImplementedException(); #endregion } } \ No newline at end of file diff --git a/src/WireMock.Net/Transformers/Scriban/WireMockTemplateContext.cs b/src/WireMock.Net/Transformers/Scriban/WireMockTemplateContext.cs index 817a88c5..cd71285c 100644 --- a/src/WireMock.Net/Transformers/Scriban/WireMockTemplateContext.cs +++ b/src/WireMock.Net/Transformers/Scriban/WireMockTemplateContext.cs @@ -1,19 +1,15 @@ -using Scriban; +using Scriban; using Scriban.Runtime; using WireMock.Types; -namespace WireMock.Transformers.Scriban -{ - internal class WireMockTemplateContext: TemplateContext - { - protected override IObjectAccessor GetMemberAccessorImpl(object target) - { - if (target?.GetType().GetGenericTypeDefinition() == typeof(WireMockList<>)) - { - return new WireMockListAccessor(); - } +namespace WireMock.Transformers.Scriban; - return base.GetMemberAccessorImpl(target); - } +internal class WireMockTemplateContext : TemplateContext +{ + protected override IObjectAccessor GetMemberAccessorImpl(object target) + { + return target?.GetType().GetGenericTypeDefinition() == typeof(WireMockList<>) ? + new WireMockListAccessor() : + base.GetMemberAccessorImpl(target); } } \ No newline at end of file diff --git a/src/WireMock.Net/WireMock.Net.csproj b/src/WireMock.Net/WireMock.Net.csproj index 69787ac9..0f042d25 100644 --- a/src/WireMock.Net/WireMock.Net.csproj +++ b/src/WireMock.Net/WireMock.Net.csproj @@ -127,7 +127,7 @@ - + @@ -137,7 +137,7 @@ - + diff --git a/test/WireMock.Net.Tests/Serialization/CustomPathParamMatcher.cs b/test/WireMock.Net.Tests/Serialization/CustomPathParamMatcher.cs index 1e4695c7..34fa6f58 100644 --- a/test/WireMock.Net.Tests/Serialization/CustomPathParamMatcher.cs +++ b/test/WireMock.Net.Tests/Serialization/CustomPathParamMatcher.cs @@ -41,7 +41,7 @@ public class CustomPathParamMatcher : IStringMatcher MatchOperator = matchOperator; } - public double IsMatch(string input) + public double IsMatch(string? input) { var inputParts = GetPathParts(input); if (inputParts.Length != _pathParts.Length) @@ -97,8 +97,13 @@ public class CustomPathParamMatcher : IStringMatcher public MatchOperator MatchOperator { get; } - private static string[] GetPathParts(string path) + private static string[] GetPathParts(string? path) { + if (path is null) + { + return new string[0]; + } + var hashMarkIndex = path.IndexOf('#'); if (hashMarkIndex != -1) {