I have strange error when I want to filter to a bool?.
See my unit test below to reproduce the bug.
[TestClass]
public class ExpressionBuilderTest
{
class Person
{
public bool? IsValid { get; set; }
}
[TestMethod]
public void TestFilterNullableBool()
{
var persons = new List<Person>();
var person = new Person();
persons.Add(person);
var filter = new Filter<Person>();
filter.By("IsValid", Operation.IsNull);
Assert.IsTrue(persons.Count(filter) == 1);
filter = new Filter<Person>();
filter.By("IsValid", Operation.EqualTo, true);
Assert.IsTrue(persons.Count(filter) == 0);
person.IsValid = true;
Assert.IsTrue(persons.Count(filter) == 1);
}
}
I have strange error when I want to filter to a bool?.
See my unit test below to reproduce the bug.