public void Test2() { var fastCollection = new FastCollection <int>(); var filter1 = new ComparisonFilter(OperationTargetBuilder.BuildForRoot(fastCollection), ComparisonFilterType.Less, 4); var filter2 = new ComparisonFilter(OperationTargetBuilder.BuildForRoot(fastCollection), ComparisonFilterType.Greater, 6); var filter3 = new CompoundFilter( CompoundFilter.CompoundFilterType.And, filter1, filter2); var filter4 = new ComparisonFilter(OperationTargetBuilder.BuildForRoot(fastCollection), ComparisonFilterType.Less, 2); var filter5 = new ComparisonFilter(OperationTargetBuilder.BuildForRoot(fastCollection), ComparisonFilterType.Less, 7); var filter7 = new CompoundFilter( CompoundFilter.CompoundFilterType.And, filter4, filter5); var filter6 = new ComparisonFilter(OperationTargetBuilder.BuildForRoot(fastCollection), ComparisonFilterType.Less, 8); var filter8 = new CompoundFilter( CompoundFilter.CompoundFilterType.And, filter3, filter7, filter6); var executionGroups = FiltersExecutionPipeline.Build(filter8).GetExecutionGroups(); Assert.AreEqual(0, executionGroups.ElementAt(0).Level); CollectionAssert.AreEquivalent(new [] { filter1, filter2, filter4, filter5, filter6 }, executionGroups.ElementAt(0).Filters); Assert.AreEqual(1, executionGroups.ElementAt(1).Level); Assert.AreEqual(new [] { filter3, filter7 }, executionGroups.ElementAt(1).Filters); Assert.AreEqual(2, executionGroups.ElementAt(2).Level); Assert.AreEqual(new [] { filter8 }, executionGroups.ElementAt(2).Filters); }
public void Test1() { var parser = new FiltersParser(); var fastCollection = new FastCollection <TestClassA>(); var parsed = parser.ParsePredicate((TestClassA x) => x.F1 > 3, OperationTargetBuilder.BuildForRoot(fastCollection)); Assert.IsAssignableFrom <ComparisonFilter>(parsed); Assert.AreEqual(ComparisonFilterType.Greater, ((ComparisonFilter)parsed).ComparisonFilterType); Assert.AreEqual(3, ((ComparisonFilter)parsed).Value); Assert.AreSame(fastCollection, ((ComparisonFilter)parsed).OperationTarget.RootFastCollection); }
public void Test1() { var fastCollection = new FastCollection <int>(); var filter1 = new ComparisonFilter(OperationTargetBuilder.BuildForRoot(fastCollection), ComparisonFilterType.Less, 3); var filter2 = new ComparisonFilter(OperationTargetBuilder.BuildForRoot(fastCollection), ComparisonFilterType.Greater, 6); var filter3 = new CompoundFilter( CompoundFilter.CompoundFilterType.And, filter1, filter2); var executionGroups = FiltersExecutionPipeline.Build(filter3).GetExecutionGroups(); Assert.AreEqual(0, executionGroups.ElementAt(0).Level); CollectionAssert.AreEquivalent(new [] { filter1, filter2 }, executionGroups.ElementAt(0).Filters); Assert.AreEqual(1, executionGroups.ElementAt(1).Level); CollectionAssert.AreEquivalent(new [] { filter3 }, executionGroups.ElementAt(1).Filters); }
public void AndCompoundTest() { var parser = new FiltersParser(); var fastCollection = new FastCollection <TestClassA>(); var parsed = parser.ParsePredicate((TestClassA x) => (x.F1 > 3) && (x.F1 <= 10), OperationTargetBuilder.BuildForRoot(fastCollection)); Assert.IsAssignableFrom <CompoundFilter>(parsed); Assert.AreEqual(CompoundFilter.CompoundFilterType.And, ((CompoundFilter)parsed).OperationType); var filter1 = (ComparisonFilter)((CompoundFilter)parsed).Operands.ElementAt(0); Assert.AreEqual(ComparisonFilterType.Greater, filter1.ComparisonFilterType); Assert.AreEqual(3, filter1.Value); var filter2 = (ComparisonFilter)((CompoundFilter)parsed).Operands.ElementAt(1); Assert.AreEqual(ComparisonFilterType.LessOrEqual, filter2.ComparisonFilterType); Assert.AreEqual(10, filter2.Value); }
/// <inheritdoc /> public IFastCollectionEnumerator <TData> GetEnumerator() { return(new FastCollectionIterator <TData>(this, OperationTargetBuilder.BuildForRoot(this), Items)); }