From 8746c32bc69afee4ae2d86d82ac8ace758e6b758 Mon Sep 17 00:00:00 2001 From: Java Roy Date: Thu, 21 Sep 2023 09:25:25 +0000 Subject: [PATCH] Added Missing Using Statements Switched to string.Concat because Path.Combine changes might differ per OS --- test/DynamicExpresso.UnitTest/GithubIssues.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/DynamicExpresso.UnitTest/GithubIssues.cs b/test/DynamicExpresso.UnitTest/GithubIssues.cs index 48ac6fc..95d39d6 100644 --- a/test/DynamicExpresso.UnitTest/GithubIssues.cs +++ b/test/DynamicExpresso.UnitTest/GithubIssues.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Reflection; using System.Text.RegularExpressions; +using System.Dynamic; // ReSharper disable SpecifyACultureInStringConversionExplicitly @@ -778,18 +779,18 @@ public void GitHub_Issue_295() { var evaluator = new Interpreter(); // create path helper functions in expressions... - Func pathCombine = Path.Combine; - evaluator.SetFunction("PathCombine", pathCombine); + Func pathCombine = string.Concat; + evaluator.SetFunction("StringConcat", pathCombine); // add a GlobalSettings dynamic object... dynamic globalSettings = new ExpandoObject(); globalSettings.MyTestPath = "C:\\delme\\"; evaluator.SetVariable("GlobalSettings", globalSettings); - var works = (string) evaluator.Eval("PathCombine((string)GlobalSettings.MyTestPath,\"test.txt\")"); + var works = (string) evaluator.Eval("StringConcat((string)GlobalSettings.MyTestPath,\"test.txt\")"); Assert.That(works, Is.EqualTo("C:\\delme\\test.txt")); - var doesntWork = (string) evaluator.Eval("PathCombine(GlobalSettings.MyTestPath,\"test.txt\")"); + var doesntWork = (string) evaluator.Eval("StringConcat(GlobalSettings.MyTestPath,\"test.txt\")"); Assert.That(doesntWork, Is.EqualTo("C:\\delme\\test.txt")); } }