public void Apply() { var newQueryModel = _nodeWithElementSelector.Apply(QueryModel, ClauseGenerationContext); Assert.That(newQueryModel, Is.SameAs(QueryModel)); Assert.That(QueryModel.ResultOperators[0], Is.InstanceOf(typeof(GroupResultOperator))); var resultOperator = (GroupResultOperator)QueryModel.ResultOperators[0]; Assert.That(resultOperator.ItemName, Is.EqualTo(_nodeWithElementSelector.AssociatedIdentifier)); Assert.That(resultOperator.KeySelector, Is.SameAs(_nodeWithElementSelector.GetResolvedKeySelector(ClauseGenerationContext))); Assert.That(resultOperator.ElementSelector, Is.SameAs(_nodeWithElementSelector.GetResolvedOptionalElementSelector(ClauseGenerationContext))); }
public void Apply_WithoutElementSelector_SuppliesStandardSelector() { _nodeWithoutElementSelector.Apply(QueryModel, ClauseGenerationContext); var resultOperator = (GroupResultOperator)QueryModel.ResultOperators[0]; var expectedElementSelector = ExpressionHelper.Resolve <int, int> (QueryModel.MainFromClause, i => i); ExpressionTreeComparer.CheckAreEqualTrees(expectedElementSelector, resultOperator.ElementSelector); }