Exemplo n.º 1
0
        public void GenerateGroupByWithSingleColumn()
        {
            var validFields = new[]
            {
                "Distinct_Values_Column",
            };


            var queryData = Builder.BuildQueryData(fields: validFields, groupBy: validFields, distinct: true);

            var sut               = new GroupByGenerator(queryData);
            var response          = sut.ToString();
            var formattedResponse = SqlFormattingManager.DefaultFormat(response);

            var expectedResponse = SqlFormattingManager.DefaultFormat("GROUP BY [Distinct_Values_Column_Cleaned]");

            Assert.Equal(expectedResponse, formattedResponse);
        }
Exemplo n.º 2
0
        public void GenerateGroupByWithManyColumnsRespectsColumnOrder()
        {
            var fields = new[]
            {
                "Distinct_Values_Column",
                "Another_Values_Column"
            };

            var groupBy = new[]
            {
                "Another_Values_Column",
                "Distinct_Values_Column"
            };

            var queryData = Builder.BuildQueryData(fields, groupBy: groupBy, distinct: true);

            var sut               = new GroupByGenerator(queryData);
            var response          = sut.ToString();
            var formattedResponse = SqlFormattingManager.DefaultFormat(response);

            var expectedResponse = SqlFormattingManager.DefaultFormat("GROUP BY [Another_Values_Column_Cleaned], [Distinct_Values_Column_Cleaned]");

            Assert.Equal(expectedResponse, formattedResponse);
        }