LINQ Select method translator.
Inheritance: IMethodTranslator
        public void LinqSelectWithProjectionClass()
        {
            // Arrange
            IQueryable<ProjectionResult> query = GetQueryable()
                .Select(p => new ProjectionResult {Name = p.Name, Continent = p.Continent, Area = p.Area});
            var translator = new SelectTranslator(_nameChanges);
            var translation = new TranslationResult();

            // Act && Assert
            translator.Translate((MethodCallExpression) query.Expression, translation);

            Assert.NotNull(translation.TableQuery);
            Assert.NotNull(translation.TableQuery.SelectColumns);
            Assert.Equal(3, translation.TableQuery.SelectColumns.Count);
            Assert.Contains("PartitionKey", translation.TableQuery.SelectColumns);
            Assert.Contains("RowKey", translation.TableQuery.SelectColumns);
            Assert.Contains("Area", translation.TableQuery.SelectColumns);

            object result = translation.PostProcessing.DynamicInvoke(GetList().AsQueryable());

            Assert.NotNull(result);
            Assert.IsAssignableFrom<IEnumerable<ProjectionResult>>(result);

            List<ProjectionResult> entities = ((IEnumerable<ProjectionResult>) result).ToList();
            IEnumerable<string> names = entities.Select(p => p.Name).ToList();

            Assert.Contains(Germany, names);
            Assert.Contains(Spain, names);
        }
        public void LinqSelectWithInvalidMethod()
        {
            // Arrange
            IQueryable<Country> query = GetQueryable().Where(p => p.Name == string.Empty);
            var translator = new SelectTranslator(_nameChanges);
            var translation = new TranslationResult();

            // Act && Assert
            Assert.Throws<ArgumentOutOfRangeException>(() => translator.Translate((MethodCallExpression) query.Expression, translation));

            Assert.NotNull(translation.TableQuery);
            Assert.Null(translation.TableQuery.SelectColumns);
        }
        public void LinqSelectWithAnonymousType()
        {
            // Arrange
            var query = GetQueryable().Select(p => new {p.Name, p.Continent});
            var translator = new SelectTranslator(_nameChanges);
            var translation = new TranslationResult();

            // Act && Assert
            translator.Translate((MethodCallExpression) query.Expression, translation);

            Assert.NotNull(translation.TableQuery);
            Assert.NotNull(translation.TableQuery.SelectColumns);
            Assert.Equal(2, translation.TableQuery.SelectColumns.Count);
            Assert.Contains("PartitionKey", translation.TableQuery.SelectColumns);
            Assert.Contains("RowKey", translation.TableQuery.SelectColumns);

            object result = translation.PostProcessing.DynamicInvoke(GetList().AsQueryable());

            Assert.NotNull(result);
            Assert.IsAssignableFrom<IEnumerable<object>>(result);
        }