public void TestToWhereExpression_ExceededMaxTerms() { var ints = new List <int>(); for (var i = 0; i <= ContainsAnyFilter <ContainsFilterTestClass> .MAX_TERMS; i++) { ints.Add(i); } var instance = new ContainsAnyFilter <ContainsFilterTestClass>("Ids", ints); instance.Invoking(x => x.ToWhereExpression()) .ShouldThrow <NotSupportedException>() .WithMessage(String.Format("The maximum number of terms to filter with is [{0}].", ContainsAnyFilter <ContainsFilterTestClass> .MAX_TERMS)); }
public void TestToWhereExpression_IntProperty_EmptyFilterValues() { var list = new List <ContainsFilterTestClass>(); list.Add(new ContainsFilterTestClass { Ids = new List <int> { 1, 2 } }); var testIds = new List <int>(); var filter = new ContainsAnyFilter <ContainsFilterTestClass>("Ids", testIds); filter.Invoking(x => x.ToWhereExpression()).ShouldThrow <NotSupportedException>() .WithMessage("There must be at least one value to filter on."); }
public void TestToWhereExpression_StringProperty_EmptyFilterValues() { var list = new List <ContainsFilterTestClass>(); list.Add(new ContainsFilterTestClass { Strings = new List <string> { "A", "B" } }); var testStrings = new List <string>(); var filter = new ContainsAnyFilter <ContainsFilterTestClass>("Strings", testStrings); filter.Invoking(x => x.ToWhereExpression()).ShouldThrow <NotSupportedException>() .WithMessage("There must be at least one value to filter on."); }