public void Test1() { var environment = new Environment("TestFqdn", "TestAccessToken"); var from = new DateTime(2017, 12, 27, 0, 0, 0, DateTimeKind.Utc); var to = new DateTime(2017, 12, 28, 0, 0, 0, DateTimeKind.Utc); var queryString = environment.AggregateQuery <TestType1>(from, to) .Select(builder => builder.UniqueValues(x => x.Value, 10, builder.UniqueValues(x => x.Value, 10, new { Maximum = builder.Maximum(x => x.Value) }))) .Where(x => x.Value > 5) .ToString(); var expected = JToken.Parse("{" + ExpectedQuery() + "}")["content"]; var actual = JToken.Parse(queryString)["content"]; Assert.True(JToken.DeepEquals(expected, actual)); }