Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
typotter committed Jun 10, 2024
1 parent 3c2d3c8 commit 39bd395
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dot-net-sdk/validators/RuleValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ private static bool EvaluateCondition(Subject subjectAttributes, Condition condi
}
}

internal class Compare
public class Compare
{
public static bool IsOneOf(HasEppoValue value, List<string> arrayValues)
{
Expand Down
22 changes: 22 additions & 0 deletions eppo-sdk-test/validators/RuleValidatorTest.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
using eppo_sdk.dto;
using eppo_sdk.validators;
using Newtonsoft.Json.Linq;

namespace eppo_sdk_test.validators;

public class RuleValidatorTest
{

[Test]
public void ShouldConvertToString()
{

var someJson = @"{""foo"":""bar"",""bar"":""baz""}"; // The ToString will serialize objects without any indenting.
var jObj = JObject.Parse(someJson);


var values = new List<Tuple<object, string>> (){
new(true, "true"),
new("true", "true"),
new(1.0, "1"),
new(3, "3"),
new(4e3, "4000"),
new(1.5, "1.5"),
new(jObj, someJson)
};

Assert.That(values.Select( v => Compare.ToString(v.Item1)), Is.EquivalentTo(values.Select(v => v.Item2)));
}
[Test]
public void ShouldMatchAndyRuleWithEmptyCondition()
{
Expand Down

0 comments on commit 39bd395

Please sign in to comment.