OR filtering tests - multiple properties (#8)

This commit is contained in:
Biarity 2018-04-19 10:16:03 +10:00 committed by GitHub
parent b041c0baff
commit 3e671f56ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,7 +27,19 @@ namespace Sieve.Models
var value = new List<IFilterTerm>();
foreach (var filter in Filters.Split(','))
{
value.Add(new FilterTerm(filter));
if (filter.StartsWith("("))
{
var filterOpAndVal = filter.Substring(filter.LastIndexOf(")") + 1);
filter = filter.Replace(subfilterOpAndVal, "").Replace("(", "").Replace(")","");
foreach (var subfilter in filter.Split("|"))
{
value.Add(new FilterTerm(subfilter + filterOpAndVal))
}
}
else
{
value.Add(new FilterTerm(filter));
}
}
return value;
}