public async Task Create_ObjectBool_OrderBy() { // arrange IRequestExecutor tester = _cache.CreateSchema <Bar, BarSortType>(_barEntities); // act IExecutionResult res1 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( "{ root(order: { foo: { barBool: ASC}}) " + "{ foo{ barBool}}}") .Create()); IExecutionResult res2 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( "{ root(order: { foo: { barBool: DESC}}) " + "{ foo{ barBool}}}") .Create()); // assert res1.MatchSqlSnapshot("ASC"); res2.MatchSqlSnapshot("DESC"); }
public async Task Should_NotInitializeObject_When_ResultOfLeftJoinIsNull_TwoFields() { // arrange IRequestExecutor tester = _cache.CreateSchema(_barWithoutRelation, OnModelCreating); // act // assert IExecutionResult res1 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @" { root { id foo { id barEnum } } }") .Create()); res1.MatchSqlSnapshot(); }
public async Task Create_Overlaps_Query() { // arrange IRequestExecutor tester = await CreateSchemaAsync <Foo, FooFilterType>(_fooEntities); // act // assert IExecutionResult res1 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ root(where: { bar: { overlaps: { geometry: { type: Polygon, coordinates: [ [150 150], [270 150], [330 150], [250 70], [190 70], [70 70], [150 150] ] } } } }){ id } }") .Create()); res1.MatchSqlSnapshot("true"); IExecutionResult res2 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ root(where: { bar: { noverlaps: { geometry: { type: Polygon, coordinates: [ [150 150], [270 150], [330 150], [250 70], [190 70], [70 70], [150 150] ] } } } }){ id } }") .Create()); res2.MatchSqlSnapshot("false"); }
public async Task Create_Touches_Query() { // arrange IRequestExecutor tester = await CreateSchemaAsync <Foo, FooFilterType>(_fooEntities); // act // assert IExecutionResult res1 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ root(where: { bar: { touches: { geometry: { type: Polygon, coordinates: [ [ [240 80], [140 120], [180 240], [280 200], [240 80] ] ] } } } }){ id } }") .Create()); res1.MatchSqlSnapshot("true"); IExecutionResult res2 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ root(where: { bar: { ntouches: { geometry: { type: Polygon, coordinates: [ [ [240 80], [140 120], [180 240], [280 200], [240 80] ] ] } } } }){ id } }") .Create()); res2.MatchSqlSnapshot("false"); }
public async Task Create_ObjectString_OrderBy_TwoProperties_Variables() { // arrange IRequestExecutor tester = _cache.CreateSchema <Bar, BarSortType>(_barEntities); // act // assert IExecutionResult res1 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @" query testSort($order: [BarSortInput]) { root(order: $order) { foo { barBool barShort } } }") .SetVariableValue( "order", new List <Dictionary <string, object> > { new Dictionary <string, object> { { "foo", new Dictionary <string, object> { { "barShort", "ASC" }, { "barBool", "ASC" } } } } }) .Create()); res1.MatchSqlSnapshot("ASC"); IExecutionResult res2 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @" query testSort($order: [BarSortInput]) { root(order: $order) { foo { barBool barShort } } }") .SetVariableValue( "order", new List <Dictionary <string, object> > { new Dictionary <string, object> { { "foo", new Dictionary <string, object> { { "barShort", "ASC" } } } }, new Dictionary <string, object> { { "foo", new Dictionary <string, object> { { "barBool", "ASC" } } } } }) .Create()); res2.MatchSqlSnapshot("ASC"); IExecutionResult res3 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @" query testSort($order: [BarSortInput]) { root(order: $order) { foo { barBool barShort } } }") .SetVariableValue( "order", new List <Dictionary <string, object> > { new Dictionary <string, object> { { "foo", new Dictionary <string, object> { { "barShort", "DESC" }, { "barBool", "DESC" } } } } }) .Create()); res3.MatchSqlSnapshot("DESC"); IExecutionResult res4 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @" query testSort($order: [BarSortInput]) { root(order: $order) { foo { barBool barShort } } }") .SetVariableValue( "order", new List <Dictionary <string, object> > { new Dictionary <string, object> { { "foo", new Dictionary <string, object> { { "barShort", "DESC" } } } }, new Dictionary <string, object> { { "foo", new Dictionary <string, object> { { "barBool", "DESC" } } } } }) .Create()); res4.MatchSqlSnapshot("DESC"); }