diff --git a/src/RulesEngine/Models/ImplicitObject.cs b/src/RulesEngine/Models/ImplicitObject.cs index 19ef52cf..12b10ac9 100644 --- a/src/RulesEngine/Models/ImplicitObject.cs +++ b/src/RulesEngine/Models/ImplicitObject.cs @@ -2,33 +2,61 @@ // Licensed under the MIT License. // https://github.com/asulwer/RulesEngine/issues/75 +using System; using System.Diagnostics.CodeAnalysis; namespace RulesEngine.Models { [ExcludeFromCodeCoverage] - public class ImplicitObject + public class ImplicitObject : IEquatable { - public static implicit operator ImplicitObject(bool value) => default; + public static implicit operator ImplicitObject(bool _) => default; - public static implicit operator ImplicitObject(bool? value) => default; + public static implicit operator ImplicitObject(bool? _) => default; - public static implicit operator ImplicitObject(char value) => default; + public static implicit operator ImplicitObject(char _) => default; - public static implicit operator ImplicitObject(char? value) => default; + public static implicit operator ImplicitObject(char? _) => default; - public static implicit operator ImplicitObject(string value) => default; + public static implicit operator ImplicitObject(string _) => default; - public static implicit operator ImplicitObject(int value) => default; + public static implicit operator ImplicitObject(int _) => default; - public static implicit operator ImplicitObject(int? value) => default; + public static implicit operator ImplicitObject(int? _) => default; - public static implicit operator ImplicitObject(decimal value) => default; + public static implicit operator ImplicitObject(decimal _) => default; - public static implicit operator ImplicitObject(decimal? value) => default; + public static implicit operator ImplicitObject(decimal? _) => default; - public static implicit operator ImplicitObject(float value) => default; + public static implicit operator ImplicitObject(float _) => default; - public static implicit operator ImplicitObject(float? value) => default; + public static implicit operator ImplicitObject(float? _) => default; + + public static bool operator <(ImplicitObject l, ImplicitObject r) => default; + + public static bool operator >(ImplicitObject l, ImplicitObject r) => default; + + public static bool operator <=(ImplicitObject l, ImplicitObject r) => default; + + public static bool operator >=(ImplicitObject l, ImplicitObject r) => default; + + public static bool operator ==(ImplicitObject l, ImplicitObject r) => default; + + public static bool operator !=(ImplicitObject l, ImplicitObject r) => default; + + public bool Equals(ImplicitObject other) + { + return default; + } + + public override bool Equals(object obj) + { + return default; + } + + public override int GetHashCode() + { + return default; + } } } \ No newline at end of file diff --git a/test/RulesEngine.UnitTest/EmptyArrayTest.cs b/test/RulesEngine.UnitTest/EmptyArrayTest.cs index b4bb38c5..133bd8a5 100644 --- a/test/RulesEngine.UnitTest/EmptyArrayTest.cs +++ b/test/RulesEngine.UnitTest/EmptyArrayTest.cs @@ -25,9 +25,32 @@ private async Task EmptyArray_ReturnsExepectedResults() WorkflowName = "Workflow", Rules = [ new() { - RuleName = "empty array", - Expression = "not things.Any(a == 3)", - RuleExpressionType = RuleExpressionType.LambdaExpression + RuleName = "equal string", + Expression = "not things.Any(a == \"widget\")" + }, + new() { + RuleName = "equal integer", + Expression = "not things.Any(a == 3)" + }, + new() { + RuleName = "not equal integer", + Expression = "not things.Any(a != 3)" + }, + new() { + RuleName = "greater than integer", + Expression = "not things.Any(a > 3)" + }, + new() { + RuleName = "less than integer", + Expression = "not things.Any(a < 3)" + }, + new() { + RuleName = "greater than equal to integer", + Expression = "not things.Any(a >= 3)" + }, + new() { + RuleName = "less than equal to integer", + Expression = "not things.Any(a <= 3)" } ] } @@ -50,12 +73,14 @@ private async Task EmptyArray_ReturnsExepectedResults() CancellationTokenSource cancellationTokenSource = new(); List results = await rulesEngine.ExecuteAllRulesAsync("Workflow", cancellationTokenSource.Token, target); - Assert.Single(results); + Assert.True(results.TrueForAll(r => r.IsSuccess)); - var result = results[0]; + foreach (var result in results) + { + Assert.Equal(result.ExceptionMessage, string.Empty); + Assert.True(result.IsSuccess); + } - Assert.Equal(result.ExceptionMessage, string.Empty); - Assert.True(result.IsSuccess); }