diff --git a/BasicNodes/Functions/Matches.cs b/BasicNodes/Functions/Matches.cs index 8083bfab..8a7f6969 100644 --- a/BasicNodes/Functions/Matches.cs +++ b/BasicNodes/Functions/Matches.cs @@ -93,6 +93,7 @@ public class Matches : Node } catch (Exception) { + // Ignored } } diff --git a/BasicNodes/Tests/MatchesTests.cs b/BasicNodes/Tests/MatchesTests.cs index 6bbef868..252013c8 100644 --- a/BasicNodes/Tests/MatchesTests.cs +++ b/BasicNodes/Tests/MatchesTests.cs @@ -6,12 +6,11 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; namespace BasicNodes.Tests; [TestClass] -public class MatchesTests +public class MatchesTests : TestBase { [TestMethod] public void Matches_Math() { - var logger = new TestLogger(); Matches ele = new (); ele.MatchConditions = new() { @@ -19,14 +18,37 @@ public class MatchesTests new("{file.Size}", ">100KB"), new("{file.Size}", ">10MB"), }; - var args = new FileFlows.Plugin.NodeParameters(null, logger, + var args = new FileFlows.Plugin.NodeParameters(null, Logger, false, string.Empty, new LocalFileService()); args.Variables["file.Size"] = 120_000; // 120KB var result = ele.Execute(args); - var log = logger.ToString(); Assert.AreEqual(2, result); } + [TestMethod] + public void Matches_EqualsOne() + { + foreach (var test in new[] + { + ((object)1, "=1"), + ((object)"1", "=1"), + ((object)1, "1"), + ((object)"1", "1"), + }) + { + Matches ele = new(); + ele.MatchConditions = new() + { + new("{myVariable}", test.Item2) + }; + var args = new FileFlows.Plugin.NodeParameters(null, Logger, + false, string.Empty, new LocalFileService()); + args.Variables["myVariable"] = test.Item1; + + var result = ele.Execute(args); + Assert.AreEqual(1, result); + } + } [TestMethod] public void Matches_String() diff --git a/FileFlows.Plugin.dll b/FileFlows.Plugin.dll index 37eb279a..bb8501e0 100644 Binary files a/FileFlows.Plugin.dll and b/FileFlows.Plugin.dll differ diff --git a/FileFlows.Plugin.pdb b/FileFlows.Plugin.pdb index 11330df4..651ebf3d 100644 Binary files a/FileFlows.Plugin.pdb and b/FileFlows.Plugin.pdb differ