diff --git a/benchmark/RulesEngineBenchmark/RulesEngineBenchmark.csproj b/benchmark/RulesEngineBenchmark/RulesEngineBenchmark.csproj index aac1da6b..b0ca1c5a 100644 --- a/benchmark/RulesEngineBenchmark/RulesEngineBenchmark.csproj +++ b/benchmark/RulesEngineBenchmark/RulesEngineBenchmark.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/RulesEngine/RulesEngine.csproj b/src/RulesEngine/RulesEngine.csproj index ce0b245e..09559d7f 100644 --- a/src/RulesEngine/RulesEngine.csproj +++ b/src/RulesEngine/RulesEngine.csproj @@ -2,7 +2,7 @@ net6.0;netstandard2.0 - 5.0.2 + 5.0.3-preview.1 Copyright (c) Microsoft Corporation. LICENSE https://github.com/microsoft/RulesEngine @@ -33,12 +33,12 @@ - - + + - + diff --git a/test/RulesEngine.UnitTest/CaseSensitiveTests.cs b/test/RulesEngine.UnitTest/CaseSensitiveTests.cs index 8f123038..20462bce 100644 --- a/test/RulesEngine.UnitTest/CaseSensitiveTests.cs +++ b/test/RulesEngine.UnitTest/CaseSensitiveTests.cs @@ -18,7 +18,6 @@ public class CaseSensitiveTests [Theory] [InlineData(true,true,false)] [InlineData(false,true,true)] - public async Task CaseSensitiveTest(bool caseSensitive, bool expected1, bool expected2) { var reSettings = new ReSettings { @@ -46,5 +45,9 @@ public async Task CaseSensitiveTest(bool caseSensitive, bool expected1, bool exp Assert.Equal(expected1, result[0].IsSuccess); Assert.Equal(expected2, result[1].IsSuccess); } + + + + } } diff --git a/test/RulesEngine.UnitTest/RulesEngine.UnitTest.csproj b/test/RulesEngine.UnitTest/RulesEngine.UnitTest.csproj index 288910d6..61be5865 100644 --- a/test/RulesEngine.UnitTest/RulesEngine.UnitTest.csproj +++ b/test/RulesEngine.UnitTest/RulesEngine.UnitTest.csproj @@ -7,11 +7,11 @@ - - + + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/test/RulesEngine.UnitTest/TypedClassTests.cs b/test/RulesEngine.UnitTest/TypedClassTests.cs index bb1fd130..2b3c7a1b 100644 --- a/test/RulesEngine.UnitTest/TypedClassTests.cs +++ b/test/RulesEngine.UnitTest/TypedClassTests.cs @@ -84,5 +84,57 @@ public async Task TypedClassTest() Assert.All(result, (res) => Assert.True(res.IsSuccess)); } + + + [Fact] + public async Task TypedClassInputSameNameAsTypeTest() + { + Workflow workflow = new() { + WorkflowName = "Conferimento", + Rules = new Rule[] { + new() { + RuleName = "Attore Da", + Enabled = true, + ErrorMessage = "Attore Da Id must be defined", + SuccessEvent = "10", + RuleExpressionType = RuleExpressionType.LambdaExpression, + Expression = "transazione.Attori.Any(a => a.RuoloAttore == 1)", + }, + new() { + RuleName = "Attore A", + Enabled = true, + ErrorMessage = "Attore A must be defined", + SuccessEvent = "10", + RuleExpressionType = RuleExpressionType.LambdaExpression, + Expression = "transazione.Attori != null", + }, + } + }; + var reSettings = new ReSettings() { + CustomTypes = new Type[] { + typeof(Transazione) + } + }; + var re = new RulesEngine(reSettings); + re.AddWorkflow(workflow); + + var param = new Transazione { + Attori = new List{ + new Attore{ + RuoloAttore = RuoloAttore.B, + + }, + new Attore { + RuoloAttore = RuoloAttore.C + } + } + + }; + + var result = await re.ExecuteAllRulesAsync("Conferimento", new RuleParameter("Transazione", param)); + + Assert.All(result, (res) => Assert.True(res.IsSuccess)); + + } } }