public async Task Passes_NotAllDataAvaliable_DoesNotProperlyMatchesData() { var source = new Dictionary <string, object>() { { "Age", 1 }, { "Likes", 1 }, { "Genetics", "white" } }; IRuleTreeValueProvider valueProvider = new DictionaryValueProvider(source); IRuleTree tree = RuleTreeMockData.AgeAndLikes_GeneticsAndName; IRuleTreeAssembler assembler = new RuleTreeAssembler(valueProvider); await assembler.Assemble(tree); var ageNode = tree.BaseNode.Children.First() as GenericComparisonRule <int>; var likesNode = tree.BaseNode.Children.ElementAt(1) as GenericComparisonRule <int>; var geneticsNode = likesNode.Children.First().Children.First() as OptionsSearchParameter <string>; var nameNode = likesNode.Children.First().Children.ElementAt(1) as GenericComparisonRule <string>; Assert.Equal("Age", ageNode.Key); Assert.Equal(1, ageNode.ComparisonValue); Assert.Equal("Likes", likesNode.Key); Assert.Equal(1, likesNode.ComparisonValue); Assert.Equal("Genetics", geneticsNode.Key); Assert.Equal("white", geneticsNode.ComparisonValue); Assert.Equal("Name", nameNode.Key); Assert.Null(nameNode.ComparisonValue); }
public async Task Passes_NotAllDataAvaliable_DoesNotPass() { var source = new Dictionary <string, object>() { { "Age", 1 }, { "Likes", 1 } }; IRuleTreeValueProvider valueProvider = new DictionaryValueProvider(source); IRuleTree tree = RuleTreeMockData.AgeAndLikes_GeneticsAndName; IRuleTreeAssembler assembler = new RuleTreeAssembler(valueProvider); await assembler.Assemble(tree); var result = await tree.Passes(); Assert.False(result); }