diff --git a/src/HotChocolate/Core/src/Execution/Instrumentation/AggregateExecutionDiagnosticEvents.cs b/src/HotChocolate/Core/src/Execution/Instrumentation/AggregateExecutionDiagnosticEvents.cs index 94805db7d03..0afcda85c05 100644 --- a/src/HotChocolate/Core/src/Execution/Instrumentation/AggregateExecutionDiagnosticEvents.cs +++ b/src/HotChocolate/Core/src/Execution/Instrumentation/AggregateExecutionDiagnosticEvents.cs @@ -144,13 +144,13 @@ public IDisposable ExecuteOperation(IRequestContext context) return new AggregateActivityScope(scopes); } - public IDisposable ExecuteStream(IRequestContext context) + public IDisposable ExecuteStream(IOperation operation) { var scopes = new IDisposable[_listeners.Length]; for (var i = 0; i < _listeners.Length; i++) { - scopes[i] = _listeners[i].ExecuteStream(context); + scopes[i] = _listeners[i].ExecuteStream(operation); } return new AggregateActivityScope(scopes); diff --git a/src/HotChocolate/Core/src/Execution/Instrumentation/ExecutionDiagnosticEventListener.cs b/src/HotChocolate/Core/src/Execution/Instrumentation/ExecutionDiagnosticEventListener.cs index d80018bc2c7..fc39201baf3 100644 --- a/src/HotChocolate/Core/src/Execution/Instrumentation/ExecutionDiagnosticEventListener.cs +++ b/src/HotChocolate/Core/src/Execution/Instrumentation/ExecutionDiagnosticEventListener.cs @@ -82,7 +82,7 @@ public virtual IDisposable ExecuteOperation(IRequestContext context) => EmptyScope; /// - public virtual IDisposable ExecuteStream(IRequestContext context) + public virtual IDisposable ExecuteStream(IOperation operation) => EmptyScope; public virtual IDisposable ExecuteDeferredTask() diff --git a/src/HotChocolate/Core/src/Execution/Instrumentation/IExecutionDiagnosticEvents.cs b/src/HotChocolate/Core/src/Execution/Instrumentation/IExecutionDiagnosticEvents.cs index 7b06e8b8348..19d4d9958d2 100644 --- a/src/HotChocolate/Core/src/Execution/Instrumentation/IExecutionDiagnosticEvents.cs +++ b/src/HotChocolate/Core/src/Execution/Instrumentation/IExecutionDiagnosticEvents.cs @@ -163,16 +163,14 @@ public interface IExecutionDiagnosticEvents /// The ExecuteStream scope will run longer then the ExecuteOperation scope. /// The ExecuteOperation scope is completed once the initial operation is executed. /// All deferred elements will be executed and delivered within the ExecuteStream scope. - /// The passed in context is polled and can only be used at the initialization of the scope. /// - /// - /// The request context encapsulates all GraphQL-specific information about an - /// individual GraphQL request. + /// + /// The operation that is being streamed. /// /// /// A scope that will be disposed when the execution has finished. /// - IDisposable ExecuteStream(IRequestContext context); + IDisposable ExecuteStream(IOperation operation); /// /// Called when starting to execute a deferred part an operation diff --git a/src/HotChocolate/Core/src/Execution/Instrumentation/NoopExecutionDiagnosticEvents.cs b/src/HotChocolate/Core/src/Execution/Instrumentation/NoopExecutionDiagnosticEvents.cs index 465d252d4e7..c8bec0f573c 100644 --- a/src/HotChocolate/Core/src/Execution/Instrumentation/NoopExecutionDiagnosticEvents.cs +++ b/src/HotChocolate/Core/src/Execution/Instrumentation/NoopExecutionDiagnosticEvents.cs @@ -44,11 +44,9 @@ public void OperationComplexityResult( public IDisposable CompileOperation(IRequestContext context) => this; - public IDisposable BuildQueryPlan(IRequestContext context) => this; - public IDisposable ExecuteOperation(IRequestContext context) => this; - public IDisposable ExecuteStream(IRequestContext context) => this; + public IDisposable ExecuteStream(IOperation operation) => this; public IDisposable ExecuteDeferredTask() => this; diff --git a/src/HotChocolate/Core/src/Execution/Processing/DeferredWorkScheduler.cs b/src/HotChocolate/Core/src/Execution/Processing/DeferredWorkScheduler.cs index 7d1b63db8d7..1b4ef0d14ba 100644 --- a/src/HotChocolate/Core/src/Execution/Processing/DeferredWorkScheduler.cs +++ b/src/HotChocolate/Core/src/Execution/Processing/DeferredWorkScheduler.cs @@ -1,6 +1,8 @@ +using System; using System.Collections.Generic; using System.Threading; using HotChocolate.Execution.DependencyInjection; +using HotChocolate.Execution.Instrumentation; using static HotChocolate.Execution.QueryResultBuilder; namespace HotChocolate.Execution.Processing; @@ -64,22 +66,36 @@ public void Complete(DeferredExecutionTaskResult result) => StateOwner.State.Complete(result); public IAsyncEnumerable CreateResultStream(IQueryResult initialResult) - => new DeferResultStream(initialResult, StateOwner); + => new DeferResultStream( + initialResult, + StateOwner, + _parentContext.Operation, + _parentContext.DiagnosticEvents); private class DeferResultStream : IAsyncEnumerable { private readonly IQueryResult _initialResult; private readonly DeferredWorkStateOwner _stateOwner; - - public DeferResultStream(IQueryResult initialResult, DeferredWorkStateOwner stateOwner) + private readonly IOperation _operation; + private readonly IExecutionDiagnosticEvents _diagnosticEvents; + + public DeferResultStream( + IQueryResult initialResult, + DeferredWorkStateOwner stateOwner, + IOperation operation, + IExecutionDiagnosticEvents diagnosticEvents) { _initialResult = FromResult(initialResult).SetHasNext(true).Create(); _stateOwner = stateOwner; + _operation = operation; + _diagnosticEvents = diagnosticEvents; } public async IAsyncEnumerator GetAsyncEnumerator( CancellationToken cancellationToken = default) { + var span = _diagnosticEvents.ExecuteStream(_operation); + try { @@ -102,6 +118,7 @@ public async IAsyncEnumerator GetAsyncEnumerator( finally { _stateOwner.Dispose(); + span.Dispose(); } } } diff --git a/src/HotChocolate/Core/src/Execution/Processing/Tasks/ResolverTaskFactory.cs b/src/HotChocolate/Core/src/Execution/Processing/Tasks/ResolverTaskFactory.cs index ce51e67318d..d87c4ee698b 100644 --- a/src/HotChocolate/Core/src/Execution/Processing/Tasks/ResolverTaskFactory.cs +++ b/src/HotChocolate/Core/src/Execution/Processing/Tasks/ResolverTaskFactory.cs @@ -20,8 +20,8 @@ public static ObjectResult EnqueueResolverTasks( Path path, IImmutableDictionary scopedContext) { - var responseIndex = 0; var selectionsCount = selectionSet.Selections.Count; + var responseIndex = selectionsCount; var parentResult = operationContext.Result.RentObject(selectionsCount); var scheduler = operationContext.Scheduler; var pathFactory = operationContext.PathFactory; @@ -35,7 +35,13 @@ public static ObjectResult EnqueueResolverTasks( { ref var selectionSpace = ref ((SelectionSet)selectionSet).GetSelectionsReference(); - for (var i = 0; i < selectionsCount; i++) + // we are iterating reverse so that in the case of a mutation the first + // synchronous root selection is executed first, since the work scheduler + // is using two stacks one for parallel work an one for synchronous work. + // the scheduler this tries to schedule new work first. + // coincidentally we can use that to schedule a mutation so that we honor the spec + // guarantees while executing efficient. + for (var i = selectionsCount - 1; i >= 0; i--) { ref var selection = ref Unsafe.Add(ref selectionSpace, i); @@ -46,7 +52,7 @@ public static ObjectResult EnqueueResolverTasks( selection, parent, parentResult, - responseIndex++, + --responseIndex, pathFactory.Append(path, selection.ResponseName), scopedContext)); } diff --git a/src/HotChocolate/Data/test/Data.AutoMapper.Tests/AutomapperTests.cs b/src/HotChocolate/Data/test/Data.AutoMapper.Tests/AutomapperTests.cs index a0196b1c770..46aad27b892 100644 --- a/src/HotChocolate/Data/test/Data.AutoMapper.Tests/AutomapperTests.cs +++ b/src/HotChocolate/Data/test/Data.AutoMapper.Tests/AutomapperTests.cs @@ -95,11 +95,11 @@ public class ProjectToTests public async Task Execute_ManyToOne() { // arrange - IRequestExecutor tester = await CreateSchema(); + var tester = await CreateSchema(); // act // assert - IExecutionResult res1 = await tester.ExecuteAsync( + var res1 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @" @@ -121,11 +121,11 @@ public async Task Execute_ManyToOne() public async Task Execute_ManyToOne_Deep() { // arrange - IRequestExecutor tester = await CreateSchema(); + var tester = await CreateSchema(); // act // assert - IExecutionResult res1 = await tester.ExecuteAsync( + var res1 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @" @@ -156,11 +156,11 @@ query Test { public async Task Execute_OneToOne() { // arrange - IRequestExecutor tester = await CreateSchema(); + var tester = await CreateSchema(); // act // assert - IExecutionResult res1 = await tester.ExecuteAsync( + var res1 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @" @@ -181,11 +181,11 @@ public async Task Execute_OneToOne() public async Task Execute_OneToOne_Deep() { // arrange - IRequestExecutor tester = await CreateSchema(); + var tester = await CreateSchema(); // act // assert - IExecutionResult res1 = await tester.ExecuteAsync( + var res1 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @" @@ -210,11 +210,11 @@ query Test { public async Task Execute_Derived_CompleteSelectionSet() { // arrange - IRequestExecutor tester = await CreateSchema(); + var tester = await CreateSchema(); // act // assert - IExecutionResult res1 = await tester.ExecuteAsync( + var res1 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @" @@ -234,11 +234,11 @@ ... on StandardMemberDto { standard } public async Task Execute_Derived_PartialSelectionSet() { // arrange - IRequestExecutor tester = await CreateSchema(); + var tester = await CreateSchema(); // act // assert - IExecutionResult res1 = await tester.ExecuteAsync( + var res1 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @" @@ -267,11 +267,11 @@ public async ValueTask CreateSchema() mc.AddProfile(new AuthorProfile()); }); - IMapper mapper = mapperConfig.CreateMapper(); + var mapper = mapperConfig.CreateMapper(); services.AddSingleton(sp => { // abusing the mapper factory to add to the database. You didnt see this. - BloggingContext context = + var context = sp.GetRequiredService>().CreateDbContext(); context.Database.EnsureCreated(); context.Blogs.AddRange(_blogEntries); diff --git a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/AuthorFixture.cs b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/AuthorFixture.cs index 9868d55d69f..9367e5bfb46 100644 --- a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/AuthorFixture.cs +++ b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/AuthorFixture.cs @@ -30,7 +30,7 @@ public class AuthorFixture : IDisposable public AuthorFixture() { _fileName = Guid.NewGuid().ToString("N") + ".db"; - BookContext context = new ServiceCollection() + var context = new ServiceCollection() .AddDbContext( b => b.UseSqlite("Data Source=" + _fileName)) .AddGraphQL() diff --git a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/EntityFrameworkExecutableTests.cs b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/EntityFrameworkExecutableTests.cs index a620f08f2c8..a92fa483182 100644 --- a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/EntityFrameworkExecutableTests.cs +++ b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/EntityFrameworkExecutableTests.cs @@ -20,7 +20,7 @@ public void Extensions_Should_ReturnEntityFrameworkExecutable_When_DBSet() { // arrange // act - IExecutable executable = _context.Authors.AsExecutable(); + var executable = _context.Authors.AsExecutable(); // assert Assert.IsType>(executable); @@ -32,7 +32,7 @@ public void Extensions_Should_ReturnEntityFrameworkExecutable_When_Queryable() { // arrange // act - IExecutable executable = _context + var executable = _context .Authors .AsQueryable() .AsEntityFrameworkExecutable(); @@ -47,7 +47,7 @@ public void Extensions_Should_ReturnEntityFrameworkExecutable_When_Queryable() public async Task ExecuteAsync_Should_ReturnAllItems_When_ToListAsync() { // arrange - IExecutable executable = _context + var executable = _context .Authors .AsExecutable(); diff --git a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/EntityFrameworkResolverCompilerIntegrationTests.cs b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/EntityFrameworkResolverCompilerIntegrationTests.cs index 1a7de41185c..f637924e2dc 100644 --- a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/EntityFrameworkResolverCompilerIntegrationTests.cs +++ b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/EntityFrameworkResolverCompilerIntegrationTests.cs @@ -48,7 +48,7 @@ public async Task Resolver_Pipeline_With_Request_DbContext_Is_Created() using AuthorFixture authorFixture = new(); - using IServiceScope scope = new ServiceCollection() + using var scope = new ServiceCollection() .AddScoped(_ => authorFixture.Context) .AddGraphQL() .AddQueryType() @@ -58,7 +58,7 @@ public async Task Resolver_Pipeline_With_Request_DbContext_Is_Created() .BuildServiceProvider() .CreateScope(); - IExecutionResult result = await scope.ServiceProvider.ExecuteRequestAsync( + var result = await scope.ServiceProvider.ExecuteRequestAsync( QueryRequestBuilder.New() .SetQuery("{ books { title } }") .SetServices(scope.ServiceProvider) @@ -74,7 +74,7 @@ public async Task Resolver_Pipeline_With_Field_DbContext_Is_Created() using AuthorFixture authorFixture = new(); - await using ServiceProvider service = new ServiceCollection() + await using var service = new ServiceCollection() .AddScoped(_ => authorFixture.Context) .AddGraphQL() .AddQueryType() diff --git a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/IntegrationTests.cs b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/IntegrationTests.cs index 7e4dbe2dfb5..f28b46ff3af 100644 --- a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/IntegrationTests.cs +++ b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/IntegrationTests.cs @@ -26,7 +26,7 @@ public IntegrationTests(AuthorFixture authorFixture) public async Task ExecuteAsync_Should_ReturnAllItems_When_ToListAsync() { // arrange - IRequestExecutor executor = await new ServiceCollection() + var executor = await new ServiceCollection() .AddGraphQL() .AddFiltering() .AddSorting() @@ -39,7 +39,7 @@ public async Task ExecuteAsync_Should_ReturnAllItems_When_ToListAsync() .BuildRequestExecutorAsync(); // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @" { executable { @@ -56,7 +56,7 @@ public async Task ExecuteAsync_Should_ReturnAllItems_When_ToListAsync() public async Task ExecuteAsync_Should_OnlyOneItem_When_SingleOrDefault() { // arrange - IRequestExecutor executor = await new ServiceCollection() + var executor = await new ServiceCollection() .AddGraphQL() .AddFiltering() .AddSorting() @@ -71,7 +71,7 @@ public async Task ExecuteAsync_Should_OnlyOneItem_When_SingleOrDefault() .BuildRequestExecutorAsync(); // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @" { executable { @@ -88,7 +88,7 @@ public async Task ExecuteAsync_Should_OnlyOneItem_When_SingleOrDefault() public async Task ExecuteAsync_Should_Fail_When_SingleOrDefaultMoreThanOne() { // arrange - IRequestExecutor executor = await new ServiceCollection() + var executor = await new ServiceCollection() .AddGraphQL() .AddFiltering() .AddSorting() @@ -106,7 +106,7 @@ public async Task ExecuteAsync_Should_Fail_When_SingleOrDefaultMoreThanOne() .BuildRequestExecutorAsync(); // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @" { executable { @@ -123,7 +123,7 @@ public async Task ExecuteAsync_Should_Fail_When_SingleOrDefaultMoreThanOne() public async Task ExecuteAsync_Should_ReturnNull_When_SingleOrDefaultZero() { // arrange - IRequestExecutor executor = await new ServiceCollection() + var executor = await new ServiceCollection() .AddGraphQL() .AddFiltering() .AddSorting() @@ -141,7 +141,7 @@ public async Task ExecuteAsync_Should_ReturnNull_When_SingleOrDefaultZero() .BuildRequestExecutorAsync(); // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @" { executable { @@ -158,7 +158,7 @@ public async Task ExecuteAsync_Should_ReturnNull_When_SingleOrDefaultZero() public async Task ExecuteAsync_Should_OnlyOneItem_When_FirstOrDefault() { // arrange - IRequestExecutor executor = await new ServiceCollection() + var executor = await new ServiceCollection() .AddGraphQL() .AddFiltering() .AddSorting() @@ -173,7 +173,7 @@ public async Task ExecuteAsync_Should_OnlyOneItem_When_FirstOrDefault() .BuildRequestExecutorAsync(); // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @" { executable { @@ -190,7 +190,7 @@ public async Task ExecuteAsync_Should_OnlyOneItem_When_FirstOrDefault() public async Task ExecuteAsync_Should_ReturnNull_When_FirstOrDefaultZero() { // arrange - IRequestExecutor executor = await new ServiceCollection() + var executor = await new ServiceCollection() .AddGraphQL() .AddFiltering() .AddSorting() @@ -208,7 +208,7 @@ public async Task ExecuteAsync_Should_ReturnNull_When_FirstOrDefaultZero() .BuildRequestExecutorAsync(); // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @" { executable { @@ -226,7 +226,7 @@ public async Task OffsetPagingExecutable() { // arrange // act - IRequestExecutor executor = await new ServiceCollection() + var executor = await new ServiceCollection() .AddPooledDbContextFactory( b => b.UseInMemoryDatabase("Data Source=EF.OffsetPagingExecutable.db")) .AddGraphQL() @@ -237,7 +237,7 @@ public async Task OffsetPagingExecutable() .BuildRequestExecutorAsync(); // assert - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @"query Test { authorOffsetPagingExecutable { items { @@ -258,7 +258,7 @@ public async Task OffsetPagingExecutable() public async Task ExecuteAsync_Should_ReturnAllItems_When_ToListAsync_AsyncEnumerable() { // arrange - IRequestExecutor executor = await new ServiceCollection() + var executor = await new ServiceCollection() .AddGraphQL() .AddFiltering() .AddSorting() @@ -274,7 +274,7 @@ public async Task ExecuteAsync_Should_ReturnAllItems_When_ToListAsync_AsyncEnume .BuildRequestExecutorAsync(); // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @" { executable { @@ -291,7 +291,7 @@ public async Task ExecuteAsync_Should_ReturnAllItems_When_ToListAsync_AsyncEnume public async Task ExecuteAsync_Should_OnlyOneItem_When_SingleOrDefault_AsyncEnumerable() { // arrange - IRequestExecutor executor = await new ServiceCollection() + var executor = await new ServiceCollection() .AddGraphQL() .AddFiltering() .AddSorting() @@ -310,7 +310,7 @@ public async Task ExecuteAsync_Should_OnlyOneItem_When_SingleOrDefault_AsyncEnum .BuildRequestExecutorAsync(); // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @" { executable { @@ -327,7 +327,7 @@ public async Task ExecuteAsync_Should_OnlyOneItem_When_SingleOrDefault_AsyncEnum public async Task ExecuteAsync_Should_Fail_When_SingleOrDefaultMoreThanOne_AsyncEnumerable() { // arrange - IRequestExecutor executor = await new ServiceCollection() + var executor = await new ServiceCollection() .AddGraphQL() .AddFiltering() .AddSorting() @@ -345,7 +345,7 @@ public async Task ExecuteAsync_Should_Fail_When_SingleOrDefaultMoreThanOne_Async .BuildRequestExecutorAsync(); // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @" { executable { @@ -362,7 +362,7 @@ public async Task ExecuteAsync_Should_Fail_When_SingleOrDefaultMoreThanOne_Async public async Task ExecuteAsync_Should_ReturnNull_When_SingleOrDefaultZero_AsyncEnumerable() { // arrange - IRequestExecutor executor = await new ServiceCollection() + var executor = await new ServiceCollection() .AddGraphQL() .AddFiltering() .AddSorting() @@ -380,7 +380,7 @@ public async Task ExecuteAsync_Should_ReturnNull_When_SingleOrDefaultZero_AsyncE .BuildRequestExecutorAsync(); // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @" { executable { @@ -397,7 +397,7 @@ public async Task ExecuteAsync_Should_ReturnNull_When_SingleOrDefaultZero_AsyncE public async Task ExecuteAsync_Should_OnlyOneItem_When_FirstOrDefault_AsyncEnumerable() { // arrange - IRequestExecutor executor = await new ServiceCollection() + var executor = await new ServiceCollection() .AddGraphQL() .AddFiltering() .AddSorting() @@ -415,7 +415,7 @@ public async Task ExecuteAsync_Should_OnlyOneItem_When_FirstOrDefault_AsyncEnume .BuildRequestExecutorAsync(); // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @" { executable { @@ -432,7 +432,7 @@ public async Task ExecuteAsync_Should_OnlyOneItem_When_FirstOrDefault_AsyncEnume public async Task ExecuteAsync_Should_ReturnNull_When_FirstOrDefaultZero_AsyncEnumerable() { // arrange - IRequestExecutor executor = await new ServiceCollection() + var executor = await new ServiceCollection() .AddGraphQL() .AddFiltering() .AddSorting() @@ -450,7 +450,7 @@ public async Task ExecuteAsync_Should_ReturnNull_When_FirstOrDefaultZero_AsyncEn .BuildRequestExecutorAsync(); // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @" { executable { diff --git a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/Query.cs b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/Query.cs index 8fd1854c131..b4c5b8fedeb 100644 --- a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/Query.cs +++ b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/Query.cs @@ -175,7 +175,7 @@ protected override void Configure(IObjectTypeDescriptor descriptor) .UseDbContext() .Resolve(ctx => { - BookContext context = ctx.DbContext(); + var context = ctx.DbContext(); return context.Books; }); @@ -184,7 +184,7 @@ protected override void Configure(IObjectTypeDescriptor descriptor) .Field("booksWithMissingContext") .Resolve(ctx => { - BookContext context = ctx.DbContext(); + var context = ctx.DbContext(); return context.Books; }); diff --git a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/SqlCursorCursorPagingIntegrationTests.cs b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/SqlCursorCursorPagingIntegrationTests.cs index 4c43c15f28f..6c308ba9822 100644 --- a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/SqlCursorCursorPagingIntegrationTests.cs +++ b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/SqlCursorCursorPagingIntegrationTests.cs @@ -22,7 +22,7 @@ public async Task Simple_StringList_Default_Items() { Snapshot.FullName(); - IRequestExecutor executor = CreateSchema(Data); + var executor = CreateSchema(Data); await executor .ExecuteAsync(@" @@ -51,7 +51,7 @@ public async Task No_Boundaries_Set() { Snapshot.FullName(); - IRequestExecutor executor = CreateSchema(Data); + var executor = CreateSchema(Data); await executor .ExecuteAsync(@" @@ -80,7 +80,7 @@ public async Task Attribute_Simple_StringList_Default_Items() { Snapshot.FullName(); - IRequestExecutor executor = CreateSchema(Data); + var executor = CreateSchema(Data); await executor .ExecuteAsync(@" @@ -109,7 +109,7 @@ public async Task Simple_StringList_First_2() { Snapshot.FullName(); - IRequestExecutor executor = CreateSchema(Data); + var executor = CreateSchema(Data); await executor .ExecuteAsync(@" @@ -138,7 +138,7 @@ public async Task Attribute_Simple_StringList_First_2() { Snapshot.FullName(); - IRequestExecutor executor = CreateSchema(Data); + var executor = CreateSchema(Data); await executor .ExecuteAsync(@" @@ -167,7 +167,7 @@ public async Task Simple_StringList_First_2_After() { Snapshot.FullName(); - IRequestExecutor executor = CreateSchema(Data); + var executor = CreateSchema(Data); await executor .ExecuteAsync(@" @@ -196,7 +196,7 @@ public async Task Attribute_Simple_StringList_First_2_After() { Snapshot.FullName(); - IRequestExecutor executor = CreateSchema(Data); + var executor = CreateSchema(Data); await executor .ExecuteAsync(@" @@ -225,7 +225,7 @@ public async Task Simple_StringList_Global_DefaultItem_2() { Snapshot.FullName(); - IRequestExecutor executor = CreateSchema(Data); + var executor = CreateSchema(Data); await executor .ExecuteAsync(@" @@ -254,7 +254,7 @@ public async Task Attribute_Simple_StringList_Global_DefaultItem_2() { Snapshot.FullName(); - IRequestExecutor executor = CreateSchema(Data); + var executor = CreateSchema(Data); await executor .ExecuteAsync(@" @@ -283,7 +283,7 @@ public async Task TotalCount_Should_Be_Correct() { Snapshot.FullName(); - IRequestExecutor executor = CreateSchema(Data); + var executor = CreateSchema(Data); await executor .ExecuteAsync(@" diff --git a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/SqlLiteCursorTestBase.cs b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/SqlLiteCursorTestBase.cs index 0c2f9ebceac..22706bcaaeb 100644 --- a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/SqlLiteCursorTestBase.cs +++ b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/SqlLiteCursorTestBase.cs @@ -18,9 +18,9 @@ private DatabaseContext BuildContext( dbContext.Database.EnsureDeleted(); dbContext.Database.EnsureCreated(); - DbSet? set = dbContext.Set(); + var set = dbContext.Set(); - foreach (TResult result in results) + foreach (var result in results) { set.Add(result); dbContext.SaveChanges(); @@ -34,14 +34,14 @@ private DatabaseContext BuildContext( protected IRequestExecutor CreateSchema(TEntity[] entities) where TEntity : class { - ISchemaBuilder builder = SchemaBuilder.New() + var builder = SchemaBuilder.New() .AddQueryType( c => c.Name("Query") .Field("root") .UseDbContext>() .Resolve(ctx => { - DatabaseContext context = + var context = ctx.DbContext>(); BuildContext(context, entities); return context.Data; @@ -68,7 +68,7 @@ protected IRequestExecutor CreateSchema(TEntity[] entities) IncludeTotalCount = true })); - ISchema schema = builder.Create(); + var schema = builder.Create(); return new ServiceCollection() .Configure( diff --git a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/SqlLiteOffsetTestBase.cs b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/SqlLiteOffsetTestBase.cs index 672dddbd875..42b72a92c07 100644 --- a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/SqlLiteOffsetTestBase.cs +++ b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/SqlLiteOffsetTestBase.cs @@ -18,9 +18,9 @@ private DatabaseContext BuildContext( dbContext.Database.EnsureDeleted(); dbContext.Database.EnsureCreated(); - DbSet? set = dbContext.Set(); + var set = dbContext.Set(); - foreach (TResult result in results) + foreach (var result in results) { set.Add(result); dbContext.SaveChanges(); @@ -34,14 +34,14 @@ private DatabaseContext BuildContext( protected IRequestExecutor CreateSchema(TEntity[] entities) where TEntity : class { - ISchemaBuilder builder = SchemaBuilder.New() + var builder = SchemaBuilder.New() .AddQueryType( c => c.Name("Query") .Field("root") .UseDbContext>() .Resolve(ctx => { - DatabaseContext context = + var context = ctx.DbContext>(); BuildContext(context, entities); return context.Data; @@ -68,7 +68,7 @@ protected IRequestExecutor CreateSchema(TEntity[] entities) IncludeTotalCount = true })); - ISchema schema = builder.Create(); + var schema = builder.Create(); return new ServiceCollection() .Configure( diff --git a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/SqlOffsetPagingIntegrationTests.cs b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/SqlOffsetPagingIntegrationTests.cs index ed21948ccde..3a8b41afc60 100644 --- a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/SqlOffsetPagingIntegrationTests.cs +++ b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/SqlOffsetPagingIntegrationTests.cs @@ -22,7 +22,7 @@ public async Task Simple_StringList_Default_Items() { Snapshot.FullName(); - IRequestExecutor executor = CreateSchema(Data); + var executor = CreateSchema(Data); await executor .ExecuteAsync(@" @@ -45,7 +45,7 @@ public async Task No_Boundaries_Set() { Snapshot.FullName(); - IRequestExecutor executor = CreateSchema(Data); + var executor = CreateSchema(Data); await executor .ExecuteAsync(@" @@ -68,7 +68,7 @@ public async Task Attribute_Simple_StringList_Default_Items() { Snapshot.FullName(); - IRequestExecutor executor = CreateSchema(Data); + var executor = CreateSchema(Data); await executor .ExecuteAsync(@" @@ -91,7 +91,7 @@ public async Task Simple_StringList_Skip_2() { Snapshot.FullName(); - IRequestExecutor executor = CreateSchema(Data); + var executor = CreateSchema(Data); await executor .ExecuteAsync(@" @@ -114,7 +114,7 @@ public async Task Attribute_Simple_StringList_Skip_2() { Snapshot.FullName(); - IRequestExecutor executor = CreateSchema(Data); + var executor = CreateSchema(Data); await executor .ExecuteAsync(@" @@ -137,7 +137,7 @@ public async Task Simple_StringList_Skip_2_After() { Snapshot.FullName(); - IRequestExecutor executor = CreateSchema(Data); + var executor = CreateSchema(Data); await executor .ExecuteAsync(@" @@ -160,7 +160,7 @@ public async Task Attribute_Simple_StringList_Skip_2_After() { Snapshot.FullName(); - IRequestExecutor executor = CreateSchema(Data); + var executor = CreateSchema(Data); await executor .ExecuteAsync(@" @@ -183,7 +183,7 @@ public async Task Simple_StringList_Global_DefaultItem_2() { Snapshot.FullName(); - IRequestExecutor executor = CreateSchema(Data); + var executor = CreateSchema(Data); await executor .ExecuteAsync(@" @@ -206,7 +206,7 @@ public async Task Attribute_Simple_StringList_Global_DefaultItem_2() { Snapshot.FullName(); - IRequestExecutor executor = CreateSchema(Data); + var executor = CreateSchema(Data); await executor .ExecuteAsync(@" @@ -229,7 +229,7 @@ public async Task TotalCount_Should_Be_Correct() { Snapshot.FullName(); - IRequestExecutor executor = CreateSchema(Data); + var executor = CreateSchema(Data); await executor .ExecuteAsync(@" diff --git a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/UseDbContextTests.cs b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/UseDbContextTests.cs index 2b668871d10..8c9c08a1476 100644 --- a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/UseDbContextTests.cs +++ b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/UseDbContextTests.cs @@ -27,21 +27,21 @@ public async Task Execute_Queryable() .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IDbContextFactory contextFactory = + var contextFactory = services.GetRequiredService>(); - await using (BookContext context = contextFactory.CreateDbContext()) + await using (var context = contextFactory.CreateDbContext()) { await context.Authors.AddAsync(new Author { Name = "foo" }); await context.SaveChangesAsync(); } // act - IExecutionResult result = await executor.ExecuteAsync("{ authors { name } }"); + var result = await executor.ExecuteAsync("{ authors { name } }"); // assert result.ToJson().MatchSnapshot(); @@ -63,21 +63,21 @@ public async Task Execute_Queryable_Task() .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IDbContextFactory contextFactory = + var contextFactory = services.GetRequiredService>(); - await using (BookContext context = contextFactory.CreateDbContext()) + await using (var context = contextFactory.CreateDbContext()) { await context.Authors.AddAsync(new Author { Name = "foo" }); await context.SaveChangesAsync(); } // act - IExecutionResult result = await executor.ExecuteAsync("{ authors { name } }"); + var result = await executor.ExecuteAsync("{ authors { name } }"); // assert result.ToJson().MatchSnapshot(); @@ -99,21 +99,21 @@ public async Task Execute_Queryable_ValueTask() .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IDbContextFactory contextFactory = + var contextFactory = services.GetRequiredService>(); - await using (BookContext context = contextFactory.CreateDbContext()) + await using (var context = contextFactory.CreateDbContext()) { await context.Authors.AddAsync(new Author { Name = "foo" }); await context.SaveChangesAsync(); } // act - IExecutionResult result = await executor.ExecuteAsync("{ authors { name } }"); + var result = await executor.ExecuteAsync("{ authors { name } }"); // assert result.ToJson().MatchSnapshot(); @@ -135,14 +135,14 @@ public async Task Execute_Queryable_OffsetPaging_TotalCount() .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IDbContextFactory contextFactory = + var contextFactory = services.GetRequiredService>(); - await using (BookContext context = contextFactory.CreateDbContext()) + await using (var context = contextFactory.CreateDbContext()) { await context.Authors.AddAsync(new Author { Name = "foo" }); await context.Authors.AddAsync(new Author { Name = "bar" }); @@ -150,7 +150,7 @@ await services.GetRequiredService() } // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @"query Test { authorOffsetPaging { items { @@ -184,14 +184,14 @@ public async Task Execute_Queryable_OffsetPaging_TotalCount_Task() .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IDbContextFactory contextFactory = + var contextFactory = services.GetRequiredService>(); - await using (BookContext context = contextFactory.CreateDbContext()) + await using (var context = contextFactory.CreateDbContext()) { await context.Authors.AddAsync(new Author { Name = "foo" }); await context.Authors.AddAsync(new Author { Name = "bar" }); @@ -199,7 +199,7 @@ await services.GetRequiredService() } // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @"query Test { authorOffsetPaging { items { @@ -233,14 +233,14 @@ public async Task Execute_Queryable_OffsetPaging_TotalCount_QueryableExtensions( .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IDbContextFactory contextFactory = + var contextFactory = services.GetRequiredService>(); - await using (BookContext context = contextFactory.CreateDbContext()) + await using (var context = contextFactory.CreateDbContext()) { await context.Authors.AddAsync(new Author { Name = "foo" }); await context.Authors.AddAsync(new Author { Name = "bar" }); @@ -248,7 +248,7 @@ await services.GetRequiredService() } // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @"query Test { queryableExtensionsOffset { items { @@ -282,14 +282,14 @@ public async Task Execute_Queryable_OffsetPaging_TotalCount_ValueTask() .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IDbContextFactory contextFactory = + var contextFactory = services.GetRequiredService>(); - await using (BookContext context = contextFactory.CreateDbContext()) + await using (var context = contextFactory.CreateDbContext()) { await context.Authors.AddAsync(new Author { Name = "foo" }); await context.Authors.AddAsync(new Author { Name = "bar" }); @@ -297,7 +297,7 @@ await services.GetRequiredService() } // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @"query Test { authorOffsetPaging { items { @@ -331,14 +331,14 @@ public async Task Execute_Queryable_OffsetPaging() .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IDbContextFactory contextFactory = + var contextFactory = services.GetRequiredService>(); - await using (BookContext context = contextFactory.CreateDbContext()) + await using (var context = contextFactory.CreateDbContext()) { await context.Authors.AddAsync(new Author { Name = "foo" }); await context.Authors.AddAsync(new Author { Name = "bar" }); @@ -346,7 +346,7 @@ await services.GetRequiredService() } // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @"query Test { authorOffsetPaging { items { @@ -379,14 +379,14 @@ public async Task Execute_Queryable_OffsetPaging_Task() .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IDbContextFactory contextFactory = + var contextFactory = services.GetRequiredService>(); - await using (BookContext context = contextFactory.CreateDbContext()) + await using (var context = contextFactory.CreateDbContext()) { await context.Authors.AddAsync(new Author { Name = "foo" }); await context.Authors.AddAsync(new Author { Name = "bar" }); @@ -394,7 +394,7 @@ await services.GetRequiredService() } // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @"query Test { authorOffsetPaging { items { @@ -427,14 +427,14 @@ public async Task Execute_Queryable_OffsetPaging_ValueTask() .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IDbContextFactory contextFactory = + var contextFactory = services.GetRequiredService>(); - await using (BookContext context = contextFactory.CreateDbContext()) + await using (var context = contextFactory.CreateDbContext()) { await context.Authors.AddAsync(new Author { Name = "foo" }); await context.Authors.AddAsync(new Author { Name = "bar" }); @@ -442,7 +442,7 @@ await services.GetRequiredService() } // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @"query Test { authorOffsetPaging { items { @@ -475,21 +475,21 @@ public async Task Execute_Single() .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IDbContextFactory contextFactory = + var contextFactory = services.GetRequiredService>(); - await using (BookContext context = contextFactory.CreateDbContext()) + await using (var context = contextFactory.CreateDbContext()) { await context.Authors.AddAsync(new Author { Name = "foo" }); await context.SaveChangesAsync(); } // act - IExecutionResult result = await executor.ExecuteAsync("{ author { name } }"); + var result = await executor.ExecuteAsync("{ author { name } }"); // assert result.ToJson().MatchSnapshot(); @@ -512,7 +512,7 @@ async Task CreateSchema() => .BuildSchemaAsync(); // assert - SchemaException exception = await Assert.ThrowsAsync(CreateSchema); + var exception = await Assert.ThrowsAsync(CreateSchema); exception.Errors.First().Message.MatchSnapshot(); } @@ -521,7 +521,7 @@ public async Task Infer_Schema_From_IQueryable_Fields() { // arrange // act - ISchema schema = + var schema = await new ServiceCollection() .AddPooledDbContextFactory( b => b.UseInMemoryDatabase(CreateConnectionString())) @@ -541,7 +541,7 @@ public async Task Infer_Schema_From_IQueryable_Task_Fields() { // arrange // act - ISchema schema = + var schema = await new ServiceCollection() .AddPooledDbContextFactory( b => b.UseInMemoryDatabase(CreateConnectionString())) @@ -561,7 +561,7 @@ public async Task Infer_Schema_From_IQueryable_ValueTask_Fields() { // arrange // act - ISchema schema = + var schema = await new ServiceCollection() .AddPooledDbContextFactory( b => b.UseInMemoryDatabase(CreateConnectionString())) @@ -580,7 +580,7 @@ public async Task Infer_Schema_From_IQueryable_ValueTask_Fields() public async Task DbContext_ResolverExtension() { // arrange - IRequestExecutor executor = + var executor = await new ServiceCollection() .AddPooledDbContextFactory( b => b.UseInMemoryDatabase(CreateConnectionString())) @@ -589,7 +589,7 @@ public async Task DbContext_ResolverExtension() .BuildRequestExecutorAsync(); // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @"query Test { books { id @@ -604,7 +604,7 @@ public async Task DbContext_ResolverExtension() public async Task DbContext_ResolverExtension_Missing_DbContext() { // arrange - IRequestExecutor executor = + var executor = await new ServiceCollection() .AddPooledDbContextFactory( b => b.UseInMemoryDatabase(CreateConnectionString())) @@ -614,7 +614,7 @@ public async Task DbContext_ResolverExtension_Missing_DbContext() .BuildRequestExecutorAsync(); // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @"query Test { booksWithMissingContext { id @@ -641,14 +641,14 @@ public async Task Execute_Queryable_CursorPaging_TotalCount() .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IDbContextFactory contextFactory = + var contextFactory = services.GetRequiredService>(); - await using (BookContext context = contextFactory.CreateDbContext()) + await using (var context = contextFactory.CreateDbContext()) { await context.Authors.AddAsync(new Author { Name = "foo" }); await context.Authors.AddAsync(new Author { Name = "bar" }); @@ -656,7 +656,7 @@ await services.GetRequiredService() } // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @"query Test { authorCursorPaging { nodes { @@ -690,14 +690,14 @@ public async Task Execute_Queryable_CursorPaging_TotalCount_Task() .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IDbContextFactory contextFactory = + var contextFactory = services.GetRequiredService>(); - await using (BookContext context = contextFactory.CreateDbContext()) + await using (var context = contextFactory.CreateDbContext()) { await context.Authors.AddAsync(new Author { Name = "foo" }); await context.Authors.AddAsync(new Author { Name = "bar" }); @@ -705,7 +705,7 @@ await services.GetRequiredService() } // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @"query Test { authorCursorPaging { nodes { @@ -739,14 +739,14 @@ public async Task Execute_Queryable_CursorPaging_TotalCount_QueryableExtensions( .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IDbContextFactory contextFactory = + var contextFactory = services.GetRequiredService>(); - await using (BookContext context = contextFactory.CreateDbContext()) + await using (var context = contextFactory.CreateDbContext()) { await context.Authors.AddAsync(new Author { Name = "foo" }); await context.Authors.AddAsync(new Author { Name = "bar" }); @@ -754,7 +754,7 @@ await services.GetRequiredService() } // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @"query Test { queryableExtensionsCursor { nodes { @@ -788,14 +788,14 @@ public async Task Execute_Queryable_CursorPaging_TotalCount_ValueTask() .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IDbContextFactory contextFactory = + var contextFactory = services.GetRequiredService>(); - await using (BookContext context = contextFactory.CreateDbContext()) + await using (var context = contextFactory.CreateDbContext()) { await context.Authors.AddAsync(new Author { Name = "foo" }); await context.Authors.AddAsync(new Author { Name = "bar" }); @@ -803,7 +803,7 @@ await services.GetRequiredService() } // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @"query Test { authorCursorPaging { nodes { @@ -837,14 +837,14 @@ public async Task Execute_Queryable_CursorPaging() .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IDbContextFactory contextFactory = + var contextFactory = services.GetRequiredService>(); - await using (BookContext context = contextFactory.CreateDbContext()) + await using (var context = contextFactory.CreateDbContext()) { await context.Authors.AddAsync(new Author { Name = "foo" }); await context.Authors.AddAsync(new Author { Name = "bar" }); @@ -852,7 +852,7 @@ await services.GetRequiredService() } // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @"query Test { authorCursorPaging { nodes { @@ -885,14 +885,14 @@ public async Task Execute_Queryable_CursorPaging_Task() .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IDbContextFactory contextFactory = + var contextFactory = services.GetRequiredService>(); - await using (BookContext context = contextFactory.CreateDbContext()) + await using (var context = contextFactory.CreateDbContext()) { await context.Authors.AddAsync(new Author { Name = "foo" }); await context.Authors.AddAsync(new Author { Name = "bar" }); @@ -900,7 +900,7 @@ await services.GetRequiredService() } // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @"query Test { authorCursorPaging { nodes { @@ -933,14 +933,14 @@ public async Task Execute_Queryable_CursorPaging_ValueTask() .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IDbContextFactory contextFactory = + var contextFactory = services.GetRequiredService>(); - await using (BookContext context = contextFactory.CreateDbContext()) + await using (var context = contextFactory.CreateDbContext()) { await context.Authors.AddAsync(new Author { Name = "foo" }); await context.Authors.AddAsync(new Author { Name = "bar" }); @@ -948,7 +948,7 @@ await services.GetRequiredService() } // act - IExecutionResult result = await executor.ExecuteAsync( + var result = await executor.ExecuteAsync( @"query Test { authorCursorPaging { nodes { diff --git a/src/HotChocolate/Diagnostics/src/Diagnostics/Listeners/ActivityDataLoaderDiagnosticListener.cs b/src/HotChocolate/Diagnostics/src/Diagnostics/Listeners/ActivityDataLoaderDiagnosticListener.cs index 471f729ed83..e827720c4d7 100644 --- a/src/HotChocolate/Diagnostics/src/Diagnostics/Listeners/ActivityDataLoaderDiagnosticListener.cs +++ b/src/HotChocolate/Diagnostics/src/Diagnostics/Listeners/ActivityDataLoaderDiagnosticListener.cs @@ -29,7 +29,7 @@ public override IDisposable ExecuteBatch( return EmptyScope; } - Activity? activity = Source.StartActivity(); + var activity = Source.StartActivity(); if (activity is null) { diff --git a/src/HotChocolate/Diagnostics/src/Diagnostics/Listeners/ActivityExecutionDiagnosticListener.cs b/src/HotChocolate/Diagnostics/src/Diagnostics/Listeners/ActivityExecutionDiagnosticListener.cs index 5a314087709..db2e29e8716 100644 --- a/src/HotChocolate/Diagnostics/src/Diagnostics/Listeners/ActivityExecutionDiagnosticListener.cs +++ b/src/HotChocolate/Diagnostics/src/Diagnostics/Listeners/ActivityExecutionDiagnosticListener.cs @@ -5,6 +5,7 @@ using HotChocolate.Diagnostics.Scopes; using HotChocolate.Execution; using HotChocolate.Execution.Instrumentation; +using HotChocolate.Execution.Processing; using HotChocolate.Resolvers; using OpenTelemetry.Trace; using static HotChocolate.Diagnostics.ContextKeys; @@ -102,7 +103,7 @@ public override IDisposable ParseDocument(IRequestContext context) return EmptyScope; } - Activity? activity = Source.StartActivity(); + var activity = Source.StartActivity(); if (activity is null) { @@ -134,7 +135,7 @@ public override IDisposable ValidateDocument(IRequestContext context) return EmptyScope; } - Activity? activity = Source.StartActivity(); + var activity = Source.StartActivity(); if (activity is null) { @@ -154,7 +155,7 @@ public override void ValidationErrors(IRequestContext context, IReadOnlyList err { var activity = (Activity)value!; - foreach (IError error in errors) + foreach (var error in errors) { _enricher.EnrichParserErrors(context, error, activity); } @@ -143,7 +143,7 @@ public override IDisposable FormatHttpResponse(HttpContext context, IQueryResult return EmptyScope; } - Activity? activity = HotChocolateActivitySource.Source.StartActivity(); + var activity = HotChocolateActivitySource.Source.StartActivity(); if (activity is null) { diff --git a/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ActivityTestHelper.cs b/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ActivityTestHelper.cs index 4c9b568be28..b82ad491152 100644 --- a/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ActivityTestHelper.cs +++ b/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ActivityTestHelper.cs @@ -25,7 +25,7 @@ public static IDisposable CaptureActivities(out object activities) if (a.Parent is null && a.OperationName.EqualsOrdinal("ExecuteHttpRequest") && - lookup.TryGetValue(rootActivity, out OrderedDictionary? parentData)) + lookup.TryGetValue(rootActivity, out var parentData)) { RegisterActivity(a, parentData); lookup[a] = (OrderedDictionary)a.GetCustomProperty("test.data")!; diff --git a/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/CustomDataLoader.cs b/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/CustomDataLoader.cs index 4289b0fb851..46a13b5b172 100644 --- a/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/CustomDataLoader.cs +++ b/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/CustomDataLoader.cs @@ -20,7 +20,7 @@ protected override Task> LoadBatchAsync( { var dict = new Dictionary(); - foreach (string key in keys) + foreach (var key in keys) { dict.Add(key, key); } diff --git a/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ServerInstrumentationTests.cs b/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ServerInstrumentationTests.cs index 7d0b630ac6f..fd6ac0b216f 100644 --- a/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ServerInstrumentationTests.cs +++ b/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ServerInstrumentationTests.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; -using HotChocolate.AspNetCore.Tests.Utilities; using Microsoft.AspNetCore.TestHost; using Microsoft.Extensions.DependencyInjection; +using HotChocolate.AspNetCore.Tests.Utilities; using Snapshooter.Xunit; using Xunit; using static HotChocolate.Diagnostics.ActivityTestHelper; @@ -25,7 +25,7 @@ public async Task Http_Post_SingleRequest_GetHeroName_Default() using (CaptureActivities(out var activities)) { // arrange - using TestServer server = CreateInstrumentedServer(); + using var server = CreateInstrumentedServer(); // act await server.PostAsync(new ClientQueryRequest @@ -49,7 +49,7 @@ public async Task Http_Post_SingleRequest_GetHeroName() using (CaptureActivities(out var activities)) { // arrange - using TestServer server = CreateInstrumentedServer( + using var server = CreateInstrumentedServer( o => o.Scopes = ActivityScopes.All); // act @@ -74,7 +74,7 @@ public async Task Http_Get_SingleRequest_GetHeroName() using (CaptureActivities(out var activities)) { // arrange - using TestServer server = CreateInstrumentedServer( + using var server = CreateInstrumentedServer( o => o.Scopes = ActivityScopes.All); // act @@ -99,7 +99,7 @@ public async Task Http_Post_variables_are_not_automatically_added_to_activities( using (CaptureActivities(out var activities)) { // arrange - using TestServer server = CreateInstrumentedServer( + using var server = CreateInstrumentedServer( o => o.Scopes = ActivityScopes.All); // act @@ -125,7 +125,7 @@ public async Task Http_Post_add_variables_to_http_activity() using (CaptureActivities(out var activities)) { // arrange - using TestServer server = CreateInstrumentedServer( + using var server = CreateInstrumentedServer( o => { o.Scopes = ActivityScopes.All; @@ -155,7 +155,7 @@ public async Task Http_Post_add_query_to_http_activity() using (CaptureActivities(out var activities)) { // arrange - using TestServer server = CreateInstrumentedServer( + using var server = CreateInstrumentedServer( o => { o.Scopes = ActivityScopes.All; @@ -185,7 +185,7 @@ public async Task Http_Post_with_extensions_map() using (CaptureActivities(out var activities)) { // arrange - using TestServer server = CreateInstrumentedServer( + using var server = CreateInstrumentedServer( o => o.Scopes = ActivityScopes.All); // act @@ -212,12 +212,12 @@ public async Task Http_Get_SDL_download() using (CaptureActivities(out var activities)) { // arrange - using TestServer server = CreateInstrumentedServer(o => o.Scopes = ActivityScopes.All); + using var server = CreateInstrumentedServer(o => o.Scopes = ActivityScopes.All); var url = TestServerExtensions.CreateUrl("/graphql?sdl"); var request = new HttpRequestMessage(HttpMethod.Get, url); // act - HttpResponseMessage response = await server.CreateClient().SendAsync(request); + var response = await server.CreateClient().SendAsync(request); // assert await response.Content.ReadAsStringAsync(); @@ -233,7 +233,7 @@ public async Task Http_Post_capture_deferred_response() using (CaptureActivities(out var activities)) { // arrange - using TestServer server = CreateInstrumentedServer(o => o.Scopes = ActivityScopes.All); + using var server = CreateInstrumentedServer(o => o.Scopes = ActivityScopes.All); // act await server.PostRawAsync(new ClientQueryRequest @@ -262,7 +262,7 @@ public async Task Http_Post_ensure_list_path_is_correctly_built() using (CaptureActivities(out var activities)) { // arrange - using TestServer server = CreateInstrumentedServer(o => o.Scopes = ActivityScopes.All); + using var server = CreateInstrumentedServer(o => o.Scopes = ActivityScopes.All); // act await server.PostRawAsync(new ClientQueryRequest @@ -297,7 +297,7 @@ public async Task Http_Post_parser_error() using (CaptureActivities(out var activities)) { // arrange - using TestServer server = CreateInstrumentedServer(o => o.Scopes = ActivityScopes.All); + using var server = CreateInstrumentedServer(o => o.Scopes = ActivityScopes.All); // act await server.PostRawAsync(new ClientQueryRequest @@ -332,7 +332,7 @@ public async Task Parsing_error_when_rename_root_is_activated() using (CaptureActivities(out var activities)) { // arrange - using TestServer server = CreateInstrumentedServer( + using var server = CreateInstrumentedServer( o => { o.Scopes = ActivityScopes.All; @@ -359,7 +359,7 @@ public async Task Validation_error_when_rename_root_is_activated() using (CaptureActivities(out var activities)) { // arrange - using TestServer server = CreateInstrumentedServer( + using var server = CreateInstrumentedServer( o => { o.Scopes = ActivityScopes.All; diff --git a/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/__snapshots__/ServerInstrumentationTests.Http_Post_capture_deferred_response.snap b/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/__snapshots__/ServerInstrumentationTests.Http_Post_capture_deferred_response.snap index 5aa6ff98547..cb9f0925278 100644 --- a/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/__snapshots__/ServerInstrumentationTests.Http_Post_capture_deferred_response.snap +++ b/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/__snapshots__/ServerInstrumentationTests.Http_Post_capture_deferred_response.snap @@ -139,57 +139,59 @@ "Value": "OK" } ], - "event": [] - }, - { - "OperationName": "ExecuteStream", - "DisplayName": "ExecuteStream", - "Status": "Unset", - "tags": [], - "event": [] + "event": [], + "activities": [ + { + "OperationName": "ResolveFieldValue", + "DisplayName": "/hero/id", + "Status": "Ok", + "tags": [ + { + "Key": "graphql.selection.name", + "Value": "id" + }, + { + "Key": "graphql.selection.type", + "Value": "ID!" + }, + { + "Key": "graphql.selection.path", + "Value": "/hero/id" + }, + { + "Key": "graphql.selection.hierarchy", + "Value": "/hero/id" + }, + { + "Key": "graphql.selection.field.name", + "Value": "id" + }, + { + "Key": "graphql.selection.field.coordinate", + "Value": "Droid.id" + }, + { + "Key": "graphql.selection.field.declaringType", + "Value": "Droid" + }, + { + "Key": "otel.status_code", + "Value": "OK" + } + ], + "event": [] + } + ] } ] } ] }, { - "OperationName": "ResolveFieldValue", - "DisplayName": "/hero/id", - "Status": "Ok", - "tags": [ - { - "Key": "graphql.selection.name", - "Value": "id" - }, - { - "Key": "graphql.selection.type", - "Value": "ID!" - }, - { - "Key": "graphql.selection.path", - "Value": "/hero/id" - }, - { - "Key": "graphql.selection.hierarchy", - "Value": "/hero/id" - }, - { - "Key": "graphql.selection.field.name", - "Value": "id" - }, - { - "Key": "graphql.selection.field.coordinate", - "Value": "Droid.id" - }, - { - "Key": "graphql.selection.field.declaringType", - "Value": "Droid" - }, - { - "Key": "otel.status_code", - "Value": "OK" - } - ], + "OperationName": "ExecuteStream", + "DisplayName": "ExecuteStream", + "Status": "Unset", + "tags": [], "event": [] } ] diff --git a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/ArrayFilterTests.cs b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/ArrayFilterTests.cs index 940cb6ac0bc..bc17e27cd5f 100644 --- a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/ArrayFilterTests.cs +++ b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/ArrayFilterTests.cs @@ -9,243 +9,242 @@ using HotChocolate.Execution; using Snapshooter.Xunit; -namespace HotChocolate.Types.Filters +namespace HotChocolate.Types.Filters; + +[Obsolete] +public class ArrayFilterTests + : IClassFixture { - [Obsolete] - public class ArrayFilterTests - : IClassFixture + private readonly MongoResource _mongoResource; + + public ArrayFilterTests(MongoResource mongoResource) { - private readonly MongoResource _mongoResource; + _mongoResource = mongoResource; + } - public ArrayFilterTests(MongoResource mongoResource) + [Fact] + public async Task Array_Filter_On_Scalar_Types() + { + // arrange + IServiceProvider services = new ServiceCollection() + .AddSingleton>(sp => + { + var database = _mongoResource.CreateDatabase(); + return database.GetCollection("col"); + }) + .AddGraphQL() + .AddQueryType() + .BindRuntimeType() + .Services + .BuildServiceProvider(); + + var executor = + await services.GetRequiredService() + .GetRequestExecutorAsync(); + + var collection = services.GetRequiredService>(); + + await collection.InsertOneAsync(new Foo { - _mongoResource = mongoResource; - } + BarCollection = new List { "a", "b", "c" }, + BazCollection = new List { new Baz { Quux = "a" }, new Baz { Quux = "b" } }, + Bars = new[] { "d", "e", "f" }, + Bazs = new[] { new Baz { Quux = "c" }, new Baz { Quux = "d" } }, + Quux = "abc" + }); + + var schema = SchemaBuilder.New() + .AddQueryType() + .AddServices(services) + .BindClrType() + .Create(); + + var request = QueryRequestBuilder.New() + .SetQuery( + "{" + + "foos(where: { bars_some: { element: \"e\" } }) { bars } " + + "}") + .Create(); + + // act + var result = await executor.ExecuteAsync(request); + + // assert + result.MatchSnapshot(); + } - [Fact] - public async Task Array_Filter_On_Scalar_Types() - { - // arrange - IServiceProvider services = new ServiceCollection() - .AddSingleton>(sp => - { - IMongoDatabase database = _mongoResource.CreateDatabase(); - return database.GetCollection("col"); - }) - .AddGraphQL() - .AddQueryType() - .BindRuntimeType() - .Services - .BuildServiceProvider(); - - IRequestExecutor executor = - await services.GetRequiredService() - .GetRequestExecutorAsync(); - - IMongoCollection collection = services.GetRequiredService>(); - - await collection.InsertOneAsync(new Foo + [Fact] + public async Task Array_Filter_On_Objects_Types() + { + // arrange + IServiceProvider services = new ServiceCollection() + .AddSingleton>(sp => { - BarCollection = new List { "a", "b", "c" }, - BazCollection = new List { new Baz { Quux = "a" }, new Baz { Quux = "b" } }, - Bars = new[] { "d", "e", "f" }, - Bazs = new[] { new Baz { Quux = "c" }, new Baz { Quux = "d" } }, - Quux = "abc" - }); - - ISchema schema = SchemaBuilder.New() - .AddQueryType() - .AddServices(services) - .BindClrType() - .Create(); - - IReadOnlyQueryRequest request = QueryRequestBuilder.New() - .SetQuery( - "{" + - "foos(where: { bars_some: { element: \"e\" } }) { bars } " + - "}") - .Create(); - - // act - IExecutionResult result = await executor.ExecuteAsync(request); - - // assert - result.MatchSnapshot(); - } - - [Fact] - public async Task Array_Filter_On_Objects_Types() + var database = _mongoResource.CreateDatabase(); + return database.GetCollection("col"); + }) + .AddGraphQL() + .AddQueryType() + .BindRuntimeType() + .Services + .BuildServiceProvider(); + + var executor = + await services.GetRequiredService() + .GetRequestExecutorAsync(); + + var collection = services.GetRequiredService>(); + + await collection.InsertOneAsync(new Foo { - // arrange - IServiceProvider services = new ServiceCollection() - .AddSingleton>(sp => - { - IMongoDatabase database = _mongoResource.CreateDatabase(); - return database.GetCollection("col"); - }) - .AddGraphQL() - .AddQueryType() - .BindRuntimeType() - .Services - .BuildServiceProvider(); - - IRequestExecutor executor = - await services.GetRequiredService() - .GetRequestExecutorAsync(); - - IMongoCollection collection = services.GetRequiredService>(); - - await collection.InsertOneAsync(new Foo - { - BarCollection = new List { "a", "b", "c" }, - BazCollection = new List { new Baz { Quux = "a" }, new Baz { Quux = "b" } }, - Bars = new[] { "d", "e", "f" }, - Bazs = new[] { new Baz { Quux = "c" }, new Baz { Quux = "d" } }, - Quux = "abc" - }); - - IReadOnlyQueryRequest request = QueryRequestBuilder.New() - .SetQuery( - "{" + - "a: foos(where: { bazs_some: { quux: \"c\" } }) { bars } " + - "}") - .Create(); - - // act - IExecutionResult result = await executor.ExecuteAsync(request); - - // assert - result.MatchSnapshot(); - } + BarCollection = new List { "a", "b", "c" }, + BazCollection = new List { new Baz { Quux = "a" }, new Baz { Quux = "b" } }, + Bars = new[] { "d", "e", "f" }, + Bazs = new[] { new Baz { Quux = "c" }, new Baz { Quux = "d" } }, + Quux = "abc" + }); + + var request = QueryRequestBuilder.New() + .SetQuery( + "{" + + "a: foos(where: { bazs_some: { quux: \"c\" } }) { bars } " + + "}") + .Create(); + + // act + var result = await executor.ExecuteAsync(request); + + // assert + result.MatchSnapshot(); + } - [Fact] - public async Task Collection_Filter_On_Scalar_Types() - { - // arrange - IServiceProvider services = new ServiceCollection() - .AddSingleton>(sp => - { - IMongoDatabase database = _mongoResource.CreateDatabase(); - return database.GetCollection("col"); - }) - .AddGraphQL() - .AddQueryType() - .BindRuntimeType() - .Services - .BuildServiceProvider(); - - IRequestExecutor executor = - await services.GetRequiredService() - .GetRequestExecutorAsync(); - - IMongoCollection collection = services.GetRequiredService>(); - - await collection.InsertOneAsync(new Foo + [Fact] + public async Task Collection_Filter_On_Scalar_Types() + { + // arrange + IServiceProvider services = new ServiceCollection() + .AddSingleton>(sp => { - BarCollection = new List { "a", "b", "c" }, - BazCollection = new List { new Baz { Quux = "a" }, new Baz { Quux = "b" } }, - Bars = new[] { "d", "e", "f" }, - Bazs = new[] { new Baz { Quux = "c" }, new Baz { Quux = "d" } }, - Quux = "abc" - }); - - ISchema schema = SchemaBuilder.New() - .AddQueryType() - .AddServices(services) - .BindClrType() - .Create(); - - IReadOnlyQueryRequest request = QueryRequestBuilder.New() - .SetQuery( - "{" + - "foos(where: { barCollection_some: { element: \"b\" } }) { bars } " + - "}") - .Create(); - - // act - IExecutionResult result = await executor.ExecuteAsync(request); - - // assert - result.MatchSnapshot(); - } - - [Fact] - public async Task Collection_Filter_On_Objects_Types() + var database = _mongoResource.CreateDatabase(); + return database.GetCollection("col"); + }) + .AddGraphQL() + .AddQueryType() + .BindRuntimeType() + .Services + .BuildServiceProvider(); + + var executor = + await services.GetRequiredService() + .GetRequestExecutorAsync(); + + var collection = services.GetRequiredService>(); + + await collection.InsertOneAsync(new Foo { - // arrange - IServiceProvider services = new ServiceCollection() - .AddSingleton>(sp => - { - IMongoDatabase database = _mongoResource.CreateDatabase(); - return database.GetCollection("col"); - }) - .AddGraphQL() - .AddQueryType() - .BindRuntimeType() - .Services - .BuildServiceProvider(); - - IRequestExecutor executor = - await services.GetRequiredService() - .GetRequestExecutorAsync(); - - IMongoCollection collection = services.GetRequiredService>(); - - await collection.InsertOneAsync(new Foo - { - BarCollection = new List { "a", "b", "c" }, - BazCollection = new List { new Baz { Quux = "a" }, new Baz { Quux = "b" } }, - Bars = new[] { "d", "e", "f" }, - Bazs = new[] { new Baz { Quux = "c" }, new Baz { Quux = "d" } }, - Quux = "abc" - }); - - ISchema schema = SchemaBuilder.New() - .AddQueryType() - .AddServices(services) - .BindClrType() - .Create(); - - IReadOnlyQueryRequest request = QueryRequestBuilder.New() - .SetQuery( - "{" + - "a: foos(where: { bazCollection_some: { quux: \"a\" } }) { bars } " + - "}") - .Create(); - - // act - IExecutionResult result = await executor.ExecuteAsync(request); - - // assert - result.MatchSnapshot(); - } + BarCollection = new List { "a", "b", "c" }, + BazCollection = new List { new Baz { Quux = "a" }, new Baz { Quux = "b" } }, + Bars = new[] { "d", "e", "f" }, + Bazs = new[] { new Baz { Quux = "c" }, new Baz { Quux = "d" } }, + Quux = "abc" + }); + + var schema = SchemaBuilder.New() + .AddQueryType() + .AddServices(services) + .BindClrType() + .Create(); + + var request = QueryRequestBuilder.New() + .SetQuery( + "{" + + "foos(where: { barCollection_some: { element: \"b\" } }) { bars } " + + "}") + .Create(); + + // act + var result = await executor.ExecuteAsync(request); + + // assert + result.MatchSnapshot(); + } - public class QueryType : ObjectType - { - protected override void Configure(IObjectTypeDescriptor descriptor) + [Fact] + public async Task Collection_Filter_On_Objects_Types() + { + // arrange + IServiceProvider services = new ServiceCollection() + .AddSingleton>(sp => { - descriptor.Name("Query"); - descriptor.Field("foos") - .Type>>() - .UseFiltering>() - .Resolve(ctx => ctx.Service>().AsQueryable()); - } - } - - public class Foo + var database = _mongoResource.CreateDatabase(); + return database.GetCollection("col"); + }) + .AddGraphQL() + .AddQueryType() + .BindRuntimeType() + .Services + .BuildServiceProvider(); + + var executor = + await services.GetRequiredService() + .GetRequestExecutorAsync(); + + var collection = services.GetRequiredService>(); + + await collection.InsertOneAsync(new Foo { - [GraphQLType(typeof(NonNullType))] - public ObjectId Id { get; set; } - public string[] Bars { get; set; } - public Baz[] Bazs { get; set; } - public ICollection BarCollection { get; set; } - public ICollection BazCollection { get; set; } - public string Quux { get; set; } - } + BarCollection = new List { "a", "b", "c" }, + BazCollection = new List { new Baz { Quux = "a" }, new Baz { Quux = "b" } }, + Bars = new[] { "d", "e", "f" }, + Bazs = new[] { new Baz { Quux = "c" }, new Baz { Quux = "d" } }, + Quux = "abc" + }); + + var schema = SchemaBuilder.New() + .AddQueryType() + .AddServices(services) + .BindClrType() + .Create(); + + var request = QueryRequestBuilder.New() + .SetQuery( + "{" + + "a: foos(where: { bazCollection_some: { quux: \"a\" } }) { bars } " + + "}") + .Create(); + + // act + var result = await executor.ExecuteAsync(request); + + // assert + result.MatchSnapshot(); + } - public class Baz + public class QueryType : ObjectType + { + protected override void Configure(IObjectTypeDescriptor descriptor) { - public string Quux { get; set; } + descriptor.Name("Query"); + descriptor.Field("foos") + .Type>>() + .UseFiltering>() + .Resolve(ctx => ctx.Service>().AsQueryable()); } } + + public class Foo + { + [GraphQLType(typeof(NonNullType))] + public ObjectId Id { get; set; } + public string[] Bars { get; set; } + public Baz[] Bazs { get; set; } + public ICollection BarCollection { get; set; } + public ICollection BazCollection { get; set; } + public string Quux { get; set; } + } + + public class Baz + { + public string Quux { get; set; } + } } diff --git a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/HotChocolate.Types.Filters.Mongo.Tests.csproj b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/HotChocolate.Types.Filters.Mongo.Tests.csproj index 1092ac1a6ac..95692a4096f 100644 --- a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/HotChocolate.Types.Filters.Mongo.Tests.csproj +++ b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/HotChocolate.Types.Filters.Mongo.Tests.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/MongoFilterTests.cs b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/MongoFilterTests.cs index b0e57b163e1..135736485c8 100644 --- a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/MongoFilterTests.cs +++ b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/MongoFilterTests.cs @@ -1,7 +1,6 @@ using System; using System.Threading.Tasks; using HotChocolate.Execution; -using HotChocolate.Types.Relay; using Microsoft.Extensions.DependencyInjection; using MongoDB.Bson; using MongoDB.Driver; @@ -9,281 +8,273 @@ using Squadron; using Xunit; -namespace HotChocolate.Types.Filters +namespace HotChocolate.Types.Filters; + +[Obsolete] +public class MongoFilterTests : IClassFixture { - [Obsolete] - public class MongoFilterTests - : IClassFixture - { - private readonly MongoResource _mongoResource; + private readonly MongoResource _mongoResource; - public MongoFilterTests(MongoResource mongoResource) - { - _mongoResource = mongoResource; - } + public MongoFilterTests(MongoResource mongoResource) + { + _mongoResource = mongoResource; + } - [Fact] - public async Task GetItems_NoFilter_AllItems_Are_Returned() - { - // arrange - IServiceProvider services = new ServiceCollection() - .AddSingleton>(sp => + [Fact] + public async Task GetItems_NoFilter_AllItems_Are_Returned() + { + // arrange + IServiceProvider services = new ServiceCollection() + .AddSingleton(_ => + { + var database = _mongoResource.CreateDatabase(); + var collection = database.GetCollection("col"); + collection.InsertMany(new[] { - IMongoDatabase database = _mongoResource.CreateDatabase(); + new Model { Foo = "abc", Bar = 1, Baz = true }, + new Model { Foo = "def", Bar = 2, Baz = false }, + }); + return collection; + }) + .AddGraphQL() + .AddQueryType() + .Services + .BuildServiceProvider(); - IMongoCollection collection = database.GetCollection("col"); - collection.InsertMany(new[] - { - new Model { Foo = "abc", Bar = 1, Baz = true }, - new Model { Foo = "def", Bar = 2, Baz = false }, - }); - return collection; - }) - .AddGraphQL() - .AddQueryType() - .Services - .BuildServiceProvider(); - - IRequestExecutor executor = - await services.GetRequiredService() - .GetRequestExecutorAsync(); - - IReadOnlyQueryRequest request = QueryRequestBuilder.New() - .SetQuery("{ items { foo } }") - .Create(); - - // act - IExecutionResult result = await executor.ExecuteAsync(request); - - // assert - result.MatchSnapshot(); - } + var executor = + await services.GetRequiredService() + .GetRequestExecutorAsync(); - [Fact] - public async Task GetItems_EqualsFilter_FirstItems_Is_Returned() - { - // arrange - IServiceProvider services = new ServiceCollection() - .AddSingleton>(sp => - { - IMongoDatabase database = _mongoResource.CreateDatabase(); + var request = QueryRequestBuilder.New() + .SetQuery("{ items { foo } }") + .Create(); - IMongoCollection collection = database.GetCollection("col"); - collection.InsertMany(new[] - { - new Model { Foo = "abc", Bar = 1, Baz = true }, - new Model { Foo = "def", Bar = 2, Baz = false }, - }); - return collection; - }) - .AddGraphQL() - .AddQueryType() - .Services - .BuildServiceProvider(); - - IRequestExecutor executor = - await services.GetRequiredService() - .GetRequestExecutorAsync(); - - IReadOnlyQueryRequest request = QueryRequestBuilder.New() - .SetQuery("{ items(where: { foo: \"abc\" }) { foo } }") - .Create(); - - // act - IExecutionResult result = await executor.ExecuteAsync(request); - - // assert - result.MatchSnapshot(); - } + // act + var result = await executor.ExecuteAsync(request); - [Fact] - public async Task GetItems_ObjectEqualsFilter_FirstItems_Is_Returned() - { - // arrange - var serviceCollection = new ServiceCollection(); - IServiceProvider services = new ServiceCollection() - .AddSingleton>(sp => + // assert + result.ToJson().MatchSnapshot(); + } + + [Fact] + public async Task GetItems_EqualsFilter_FirstItems_Is_Returned() + { + // arrange + IServiceProvider services = new ServiceCollection() + .AddSingleton(_ => + { + var database = _mongoResource.CreateDatabase(); + var collection = database.GetCollection("col"); + collection.InsertMany(new[] { - IMongoDatabase database = _mongoResource.CreateDatabase(); + new Model { Foo = "abc", Bar = 1, Baz = true }, + new Model { Foo = "def", Bar = 2, Baz = false }, + }); + return collection; + }) + .AddGraphQL() + .AddQueryType() + .Services + .BuildServiceProvider(); + + var executor = + await services.GetRequiredService() + .GetRequestExecutorAsync(); - IMongoCollection collection = database.GetCollection("col"); - collection.InsertMany(new[] + var request = QueryRequestBuilder.New() + .SetQuery("{ items(where: { foo: \"abc\" }) { foo } }") + .Create(); + + // act + var result = await executor.ExecuteAsync(request); + + // assert + result.ToJson().MatchSnapshot(); + } + + [Fact] + public async Task GetItems_ObjectEqualsFilter_FirstItems_Is_Returned() + { + // arrange + IServiceProvider services = new ServiceCollection() + .AddSingleton(_ => + { + var database = _mongoResource.CreateDatabase(); + + var collection = database.GetCollection("col"); + collection.InsertMany(new[] + { + new Model { - new Model - { - Nested = null - }, - new Model + Nested = null + }, + new Model + { + Nested = new Model { Nested = new Model { - Nested = new Model - { - Foo = "abc", - Bar = 1, - Baz = true - } + Foo = "abc", + Bar = 1, + Baz = true } - }, - new Model + } + }, + new Model + { + Nested = new Model { - Nested = new Model + Nested= new Model { - Nested= new Model - { - Foo = "def", - Bar = 2, - Baz = false - } + Foo = "def", + Bar = 2, + Baz = false } - }, - }); - return collection; - }) - .AddGraphQL() - .AddQueryType() - .Services - .BuildServiceProvider(); - - IRequestExecutor executor = - await services.GetRequiredService() - .GetRequestExecutorAsync(); - - IReadOnlyQueryRequest request = QueryRequestBuilder.New() - .SetQuery( - "{ items(where: { nested:{ nested: { foo: \"abc\" " + - "} } }) { nested { nested { foo } } } }") - .Create(); - - // act - IExecutionResult result = await executor.ExecuteAsync(request); - - // assert - result.MatchSnapshot(); - } + } + }, + }); + return collection; + }) + .AddGraphQL() + .AddQueryType() + .Services + .BuildServiceProvider(); + + var executor = + await services.GetRequiredService() + .GetRequestExecutorAsync(); + + var request = QueryRequestBuilder.New() + .SetQuery( + "{ items(where: { nested:{ nested: { foo: \"abc\" " + + "} } }) { nested { nested { foo } } } }") + .Create(); + + // act + var result = await executor.ExecuteAsync(request); + + // assert + result.ToJson().MatchSnapshot(); + } - [Fact] - public async Task GetItems_With_Paging_EqualsFilter_FirstItems_Is_Returned() - { - // arrange - IServiceProvider services = new ServiceCollection() - .AddSingleton>(sp => + [Fact] + public async Task GetItems_With_Paging_EqualsFilter_FirstItems_Is_Returned() + { + // arrange + IServiceProvider services = new ServiceCollection() + .AddSingleton(_ => + { + var database = _mongoResource.CreateDatabase(); + + var collection = database.GetCollection("col"); + collection.InsertMany(new[] { - IMongoDatabase database = _mongoResource.CreateDatabase(); + new Model { Foo = "abc", Bar = 1, Baz = true }, + new Model { Foo = "def", Bar = 2, Baz = false }, + }); + return collection; + }) + .AddGraphQL() + .AddQueryType() + .Services + .BuildServiceProvider(); - IMongoCollection collection = database.GetCollection("col"); - collection.InsertMany(new[] - { - new Model { Foo = "abc", Bar = 1, Baz = true }, - new Model { Foo = "def", Bar = 2, Baz = false }, - }); - return collection; - }) - .AddGraphQL() - .AddQueryType() - .Services - .BuildServiceProvider(); - - IRequestExecutor executor = - await services.GetRequiredService() - .GetRequestExecutorAsync(); - - IReadOnlyQueryRequest request = QueryRequestBuilder.New() - .SetQuery("{ paging(where: { foo: \"abc\" }) { nodes { foo } } }") - .Create(); - - // act - IExecutionResult result = await executor.ExecuteAsync(request); - - // assert - result.MatchSnapshot(); - } + var executor = + await services.GetRequiredService() + .GetRequestExecutorAsync(); - [Fact] - public async Task Boolean_Filter_Equals() - { - // arrange - IServiceProvider services = new ServiceCollection() - .AddSingleton>(sp => - { - IMongoDatabase database = _mongoResource.CreateDatabase(); + var request = QueryRequestBuilder.New() + .SetQuery("{ paging(where: { foo: \"abc\" }) { nodes { foo } } }") + .Create(); - IMongoCollection collection = database.GetCollection("col"); - collection.InsertMany(new[] - { - new Model { Foo = "abc", Bar = 1, Baz = true }, - new Model { Foo = "def", Bar = 2, Baz = false }, - }); - return collection; - }) - .AddGraphQL() - .AddQueryType() - .Services - .BuildServiceProvider(); - - IRequestExecutor executor = - await services.GetRequiredService() - .GetRequestExecutorAsync(); - - IReadOnlyQueryRequest request = QueryRequestBuilder.New() - .SetQuery("{ paging(where: { baz: true }) { nodes { foo } } }") - .Create(); - - // act - IExecutionResult result = await executor.ExecuteAsync(request); - - // assert - result.MatchSnapshot(); - } + // act + var result = await executor.ExecuteAsync(request); - [Fact] - public async Task Boolean_Filter_Not_Equals() - { - // arrange - IServiceProvider services = new ServiceCollection() - .AddSingleton>(sp => + // assert + result.ToJson().MatchSnapshot(); + } + + [Fact] + public async Task Boolean_Filter_Equals() + { + // arrange + IServiceProvider services = new ServiceCollection() + .AddSingleton(_ => + { + var database = _mongoResource.CreateDatabase(); + var collection = database.GetCollection("col"); + collection.InsertMany(new[] { - IMongoDatabase database = _mongoResource.CreateDatabase(); + new Model { Foo = "abc", Bar = 1, Baz = true }, + new Model { Foo = "def", Bar = 2, Baz = false }, + }); + return collection; + }) + .AddGraphQL() + .AddQueryType() + .Services + .BuildServiceProvider(); - IMongoCollection collection = database.GetCollection("col"); - collection.InsertMany(new[] - { - new Model { Foo = "abc", Bar = 1, Baz = true }, - new Model { Foo = "def", Bar = 2, Baz = false }, - }); - return collection; - }) - .AddGraphQL() - .AddQueryType() - .Services - .BuildServiceProvider(); - - IRequestExecutor executor = - await services.GetRequiredService() - .GetRequestExecutorAsync(); - - IReadOnlyQueryRequest request = QueryRequestBuilder.New() - .SetQuery("{ paging(where: { baz_not: false }) { nodes { foo } } }") - .Create(); - - // act - IExecutionResult result = await executor.ExecuteAsync(request); - - // assert - result.MatchSnapshot(); - } + var executor = + await services.GetRequiredService() + .GetRequestExecutorAsync(); - [Fact] - public async Task DateTimeType_GreaterThan_Filter() - { - // arrange - var serviceCollection = new ServiceCollection(); - IServiceProvider services = new ServiceCollection() - .AddSingleton>(sp => + var request = QueryRequestBuilder.New() + .SetQuery("{ paging(where: { baz: true }) { nodes { foo } } }") + .Create(); + + // act + var result = await executor.ExecuteAsync(request); + + // assert + result.ToJson().MatchSnapshot(); + } + + [Fact] + public async Task Boolean_Filter_Not_Equals() + { + // arrange + IServiceProvider services = new ServiceCollection() + .AddSingleton(_ => + { + var database = _mongoResource.CreateDatabase(); + var collection = database.GetCollection("col"); + collection.InsertMany(new[] { - IMongoDatabase database = _mongoResource.CreateDatabase(); + new Model { Foo = "abc", Bar = 1, Baz = true }, + new Model { Foo = "def", Bar = 2, Baz = false }, + }); + return collection; + }) + .AddGraphQL() + .AddQueryType() + .Services + .BuildServiceProvider(); + + var executor = + await services.GetRequiredService() + .GetRequestExecutorAsync(); + + var request = QueryRequestBuilder.New() + .SetQuery("{ paging(where: { baz_not: false }) { nodes { foo } } }") + .Create(); + + // act + var result = await executor.ExecuteAsync(request); - IMongoCollection collection = database.GetCollection("col"); + // assert + result.ToJson().MatchSnapshot(); + } + + [Fact] + public async Task DateTimeType_GreaterThan_Filter() + { + // arrange + IServiceProvider services = new ServiceCollection() + .AddSingleton(_ => + { + var database = _mongoResource.CreateDatabase(); + var collection = database.GetCollection("col"); collection.InsertMany(new[] { new Model { Time = new DateTime(2000, 1, 1, 1, 1, 1, DateTimeKind.Utc) }, @@ -291,116 +282,112 @@ public async Task DateTimeType_GreaterThan_Filter() }); return collection; }) - .AddGraphQL() - .AddQueryType() - .Services - .BuildServiceProvider(); + .AddGraphQL() + .AddQueryType() + .Services + .BuildServiceProvider(); - IRequestExecutor executor = - await services.GetRequiredService() - .GetRequestExecutorAsync(); + var executor = + await services.GetRequiredService() + .GetRequestExecutorAsync(); - IReadOnlyQueryRequest request = QueryRequestBuilder.New() - .SetQuery("{ items(where: { time_gt: \"2001-01-01\" }) { time } }") - .Create(); + var request = QueryRequestBuilder.New() + .SetQuery("{ items(where: { time_gt: \"2001-01-01\" }) { time } }") + .Create(); - // act - IExecutionResult result = await executor.ExecuteAsync(request); + // act + var result = await executor.ExecuteAsync(request); - // assert - result.MatchSnapshot(); - } + // assert + result.ToJson().MatchSnapshot(); + } - [Fact] - public async Task DateType_GreaterThan_Filter() - { - // arrange - IServiceProvider services = new ServiceCollection() - .AddSingleton>(sp => + [Fact] + public async Task DateType_GreaterThan_Filter() + { + // arrange + IServiceProvider services = new ServiceCollection() + .AddSingleton(_ => + { + var database = _mongoResource.CreateDatabase(); + var collection = database.GetCollection("col"); + collection.InsertMany(new[] { - IMongoDatabase database = _mongoResource.CreateDatabase(); + new Model { Date = new DateTime(2000, 1, 1, 1, 1, 1, DateTimeKind.Utc).Date }, + new Model { Date = new DateTime(2016, 1, 1, 1, 1, 1, DateTimeKind.Utc).Date }, + }); + return collection; + }) + .AddGraphQL() + .AddQueryType() + .Services + .BuildServiceProvider(); - IMongoCollection collection = database.GetCollection("col"); - collection.InsertMany(new[] - { - new Model { Date = new DateTime(2000, 1, 1, 1, 1, 1, DateTimeKind.Utc).Date }, - new Model { Date = new DateTime(2016, 1, 1, 1, 1, 1, DateTimeKind.Utc).Date }, - }); - return collection; - }) - .AddGraphQL() - .AddQueryType() - .Services - .BuildServiceProvider(); - - IRequestExecutor executor = - await services.GetRequiredService() - .GetRequestExecutorAsync(); - - IReadOnlyQueryRequest request = QueryRequestBuilder.New() - .SetQuery("{ items(where: { date_gt: \"2001-01-01\" }) { date } }") - .Create(); - - // act - IExecutionResult result = await executor.ExecuteAsync(request); - - // assert - result.MatchSnapshot(); - } + var executor = + await services.GetRequiredService() + .GetRequestExecutorAsync(); + + var request = QueryRequestBuilder.New() + .SetQuery("{ items(where: { date_gt: \"2001-01-01\" }) { date } }") + .Create(); - public class QueryType : ObjectType + // act + var result = await executor.ExecuteAsync(request); + + // assert + result.ToJson().MatchSnapshot(); + } + + public class QueryType : ObjectType + { + protected override void Configure(IObjectTypeDescriptor descriptor) { - protected override void Configure(IObjectTypeDescriptor descriptor) - { - descriptor.Name("Query"); - descriptor.Field("items") - .Type>() - .UseFiltering>() - .Resolve(ctx => - ctx.Service>().AsQueryable()); - - descriptor.Field("paging") - .UsePaging() - .UseFiltering>() - .Resolve(ctx => - ctx.Service>().AsQueryable()); - } + descriptor.Name("Query"); + descriptor.Field("items") + .Type>() + .UseFiltering>() + .Resolve(ctx => ctx.Service>().AsQueryable()); + + descriptor.Field("paging") + .UsePaging() + .UseFiltering>() + .Resolve(ctx => ctx.Service>().AsQueryable()); } + } - public class ModelType : ObjectType + public class ModelType : ObjectType + { + protected override void Configure( + IObjectTypeDescriptor descriptor) { - protected override void Configure( - IObjectTypeDescriptor descriptor) - { - descriptor.Field(t => t.Id) - .Type() - .Resolve(c => c.Parent().Id); + descriptor.Field(t => t.Id) + .Type() + .Resolve(c => c.Parent().Id); - descriptor.Field(t => t.Time) - .Type>(); + descriptor.Field(t => t.Time) + .Type>(); - descriptor.Field(t => t.Date) - .Type>(); - } + descriptor.Field(t => t.Date) + .Type>(); } + } - public class Model - { - public ObjectId Id { get; set; } + public class Model + { + public ObjectId Id { get; set; } - public string Foo { get; set; } + public string Foo { get; set; } - public int Bar { get; set; } + public int Bar { get; set; } - public bool Baz { get; set; } + public bool Baz { get; set; } - public Model Nested { get; set; } + public Model Nested { get; set; } - [GraphQLType(typeof(NonNullType))] - public DateTime Time { get; set; } + [GraphQLType(typeof(NonNullType))] + public DateTime Time { get; set; } - [GraphQLType(typeof(NonNullType))] - public DateTime Date { get; set; } - } + [GraphQLType(typeof(NonNullType))] + public DateTime Date { get; set; } } } diff --git a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.Boolean_Filter_Equals.snap b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.Boolean_Filter_Equals.snap index 138806dc453..29c840b72e3 100644 --- a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.Boolean_Filter_Equals.snap +++ b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.Boolean_Filter_Equals.snap @@ -1,8 +1,5 @@ { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { + "data": { "paging": { "nodes": [ { @@ -10,9 +7,5 @@ } ] } - }, - "Errors": null, - "Extensions": null, - "ContextData": null, - "HasNext": null + } } diff --git a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.Boolean_Filter_Not_Equals.snap b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.Boolean_Filter_Not_Equals.snap index 138806dc453..29c840b72e3 100644 --- a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.Boolean_Filter_Not_Equals.snap +++ b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.Boolean_Filter_Not_Equals.snap @@ -1,8 +1,5 @@ { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { + "data": { "paging": { "nodes": [ { @@ -10,9 +7,5 @@ } ] } - }, - "Errors": null, - "Extensions": null, - "ContextData": null, - "HasNext": null + } } diff --git a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.DateTimeType_GreaterThan_Filter.snap b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.DateTimeType_GreaterThan_Filter.snap index ce1be277205..71de7c05915 100644 --- a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.DateTimeType_GreaterThan_Filter.snap +++ b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.DateTimeType_GreaterThan_Filter.snap @@ -1,16 +1,9 @@ { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { + "data": { "items": [ { "time": "2016-01-01T01:01:01.000Z" } ] - }, - "Errors": null, - "Extensions": null, - "ContextData": null, - "HasNext": null + } } diff --git a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.DateType_GreaterThan_Filter.snap b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.DateType_GreaterThan_Filter.snap index 3113d978ddd..5f2054bb7b7 100644 --- a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.DateType_GreaterThan_Filter.snap +++ b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.DateType_GreaterThan_Filter.snap @@ -1,16 +1,9 @@ { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { + "data": { "items": [ { "date": "2016-01-01" } ] - }, - "Errors": null, - "Extensions": null, - "ContextData": null, - "HasNext": null + } } diff --git a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.GetItems_EqualsFilter_FirstItems_Is_Returned.snap b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.GetItems_EqualsFilter_FirstItems_Is_Returned.snap index 52471f2f598..12d8131b1fd 100644 --- a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.GetItems_EqualsFilter_FirstItems_Is_Returned.snap +++ b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.GetItems_EqualsFilter_FirstItems_Is_Returned.snap @@ -1,16 +1,9 @@ { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { + "data": { "items": [ { "foo": "abc" } ] - }, - "Errors": null, - "Extensions": null, - "ContextData": null, - "HasNext": null + } } diff --git a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.GetItems_NoFilter_AllItems_Are_Returned.snap b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.GetItems_NoFilter_AllItems_Are_Returned.snap index 8fad505d76d..16ed88f3ae9 100644 --- a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.GetItems_NoFilter_AllItems_Are_Returned.snap +++ b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.GetItems_NoFilter_AllItems_Are_Returned.snap @@ -1,8 +1,5 @@ { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { + "data": { "items": [ { "foo": "abc" @@ -11,9 +8,5 @@ "foo": "def" } ] - }, - "Errors": null, - "Extensions": null, - "ContextData": null, - "HasNext": null + } } diff --git a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.GetItems_ObjectEqualsFilter_FirstItems_Is_Returned.snap b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.GetItems_ObjectEqualsFilter_FirstItems_Is_Returned.snap index fb82da8cd6d..f9fdfe025d3 100644 --- a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.GetItems_ObjectEqualsFilter_FirstItems_Is_Returned.snap +++ b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.GetItems_ObjectEqualsFilter_FirstItems_Is_Returned.snap @@ -1,8 +1,5 @@ { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { + "data": { "items": [ { "nested": { @@ -12,9 +9,5 @@ } } ] - }, - "Errors": null, - "Extensions": null, - "ContextData": null, - "HasNext": null + } } diff --git a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.GetItems_With_Paging_EqualsFilter_FirstItems_Is_Returned.snap b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.GetItems_With_Paging_EqualsFilter_FirstItems_Is_Returned.snap index 138806dc453..29c840b72e3 100644 --- a/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.GetItems_With_Paging_EqualsFilter_FirstItems_Is_Returned.snap +++ b/src/HotChocolate/Filters/test/Types.Filters.Mongo.Tests/__snapshots__/MongoFilterTests.GetItems_With_Paging_EqualsFilter_FirstItems_Is_Returned.snap @@ -1,8 +1,5 @@ { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { + "data": { "paging": { "nodes": [ { @@ -10,9 +7,5 @@ } ] } - }, - "Errors": null, - "Extensions": null, - "ContextData": null, - "HasNext": null + } } diff --git a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/HotChocolate.Types.Sorting.Mongo.Tests.csproj b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/HotChocolate.Types.Sorting.Mongo.Tests.csproj index 775de24eea1..a9db0c7011a 100644 --- a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/HotChocolate.Types.Sorting.Mongo.Tests.csproj +++ b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/HotChocolate.Types.Sorting.Mongo.Tests.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/MongoSortingObjectTests.cs b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/MongoSortingObjectTests.cs index df50efd67f2..786bcf7ecc2 100644 --- a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/MongoSortingObjectTests.cs +++ b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/MongoSortingObjectTests.cs @@ -25,10 +25,10 @@ public async Task GetItems_NoSorting_AllItems_Are_Returned_Unsorted() { // arrange IServiceProvider services = new ServiceCollection() - .AddSingleton>(sp => + .AddSingleton(_ => { - IMongoDatabase database = _mongoResource.CreateDatabase(); - IMongoCollection collection = database.GetCollection("col"); + var database = _mongoResource.CreateDatabase(); + var collection = database.GetCollection("col"); collection.InsertMany(new[] { new Parent { Model = new Model { Foo = "abc", Bar = 1, Baz = true } }, @@ -41,20 +41,20 @@ public async Task GetItems_NoSorting_AllItems_Are_Returned_Unsorted() .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IReadOnlyQueryRequest request = QueryRequestBuilder.New() + var request = QueryRequestBuilder.New() .SetQuery("{ items { model { foo } } }") .Create(); // act - IExecutionResult result = await executor.ExecuteAsync(request); + var result = await executor.ExecuteAsync(request); // assert Assert.Null(result.ExpectQueryResult().Errors); - result.MatchSnapshot(); + result.ToJson().MatchSnapshot(); } [Fact] @@ -62,22 +62,44 @@ public async Task GetItems_DescSorting_AllItems_Are_Returned_DescSortedOnNullabl { // arrange IServiceProvider services = new ServiceCollection() - .AddSingleton>(sp => + .AddSingleton(_ => { - IMongoDatabase database = _mongoResource.CreateDatabase(); - IMongoCollection collection = database.GetCollection("col"); - collection.InsertMany(new[] - { - new Parent { - Model = new Model { - Foo = "def", Bar = 1, Baz = true, BazNullable= 1 } }, - new Parent { - Model = new Model { - Foo = "abc", Bar = 2, Baz = false, BazNullable= 2 } }, - new Parent { - Model = new Model { - Foo = "abc", Bar = 2, Baz = false, BazNullable= null } } - }); + var database = _mongoResource.CreateDatabase(); + var collection = database.GetCollection("col"); + collection.InsertMany( + new[] + { + new Parent + { + Model = new Model + { + Foo = "def", + Bar = 1, + Baz = true, + BazNullable = 1 + } + }, + new Parent + { + Model = new Model + { + Foo = "abc", + Bar = 2, + Baz = false, + BazNullable = 2 + } + }, + new Parent + { + Model = new Model + { + Foo = "abc", + Bar = 2, + Baz = false, + BazNullable = null + } + } + }); return collection; }) .AddGraphQL() @@ -86,21 +108,25 @@ public async Task GetItems_DescSorting_AllItems_Are_Returned_DescSortedOnNullabl .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IReadOnlyQueryRequest request = QueryRequestBuilder.New() + var request = QueryRequestBuilder.New() .SetQuery( - "{ items(order_by: { model: { bazNullable: DESC } }) { model { bazNullable } } }") + @"{ + items(order_by: { model: { bazNullable: DESC } }) { + model { bazNullable } + } + }") .Create(); // act - IExecutionResult result = await executor.ExecuteAsync(request); + var result = await executor.ExecuteAsync(request); // assert Assert.Null(result.ExpectQueryResult().Errors); - result.MatchSnapshot(); + result.ToJson().MatchSnapshot(); } [Fact] @@ -108,19 +134,33 @@ public async Task GetItems_DescSorting_AllItems_Are_Returned_DescSortedOnNullabl { // arrange IServiceProvider services = new ServiceCollection() - .AddSingleton>(sp => + .AddSingleton(_ => { - IMongoDatabase database = _mongoResource.CreateDatabase(); - IMongoCollection collection = database.GetCollection("col"); + var database = _mongoResource.CreateDatabase(); + var collection = database.GetCollection("col"); collection.InsertMany(new[] { - new Parent { - Model = new Model { - Foo = "def", Bar = 1, Baz = true, BazNullable= 1 } }, - new Parent { - Model = new Model { - Foo = "abc", Bar = 2, Baz = false, BazNullable= 2 } }, - new Parent { } + new Parent + { + Model = new Model + { + Foo = "def", + Bar = 1, + Baz = true, + BazNullable = 1 + } + }, + new Parent + { + Model = new Model + { + Foo = "abc", + Bar = 2, + Baz = false, + BazNullable = 2 + } + }, + new Parent() }); return collection; }) @@ -130,21 +170,27 @@ public async Task GetItems_DescSorting_AllItems_Are_Returned_DescSortedOnNullabl .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IReadOnlyQueryRequest request = QueryRequestBuilder.New() + var request = QueryRequestBuilder.New() .SetQuery( - "{ items(order_by: { model: { bazNullable: DESC } }) { model { bazNullable } } }") + @"{ + items(order_by: { model: { bazNullable: DESC } }) { + model { + bazNullable + } + } + }") .Create(); // act - IExecutionResult result = await executor.ExecuteAsync(request); + var result = await executor.ExecuteAsync(request); // assert Assert.Null(result.ExpectQueryResult().Errors); - result.MatchSnapshot(); + result.ToJson().MatchSnapshot(); } @@ -155,8 +201,8 @@ public async Task GetItems_DescSorting_AllItems_Are_Returned_DescSorted() IServiceProvider services = new ServiceCollection() .AddSingleton(_ => { - IMongoDatabase database = _mongoResource.CreateDatabase(); - IMongoCollection collection = database.GetCollection("col"); + var database = _mongoResource.CreateDatabase(); + var collection = database.GetCollection("col"); collection.InsertMany(new[] { new Parent { Model = new Model { Foo = "abc", Bar = 1, Baz = true } }, @@ -170,20 +216,27 @@ public async Task GetItems_DescSorting_AllItems_Are_Returned_DescSorted() .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IReadOnlyQueryRequest request = QueryRequestBuilder.New() - .SetQuery("{ items(order_by: { model: { foo: DESC } }) { model { foo } } }") + var request = QueryRequestBuilder.New() + .SetQuery( + @"{ + items(order_by: { model: { foo: DESC } }) { + model { + foo + } + } + }") .Create(); // act - IExecutionResult result = await executor.ExecuteAsync(request); + var result = await executor.ExecuteAsync(request); // assert Assert.Null(result.ExpectQueryResult().Errors); - result.MatchSnapshot(); + result.ToJson().MatchSnapshot(); } [Fact] @@ -193,8 +246,8 @@ public async Task GetItems_With_Paging__DescSorting_AllItems_Are_Returned_DescSo IServiceProvider services = new ServiceCollection() .AddSingleton(_ => { - IMongoDatabase database = _mongoResource.CreateDatabase(); - IMongoCollection collection = database.GetCollection("col"); + var database = _mongoResource.CreateDatabase(); + var collection = database.GetCollection("col"); collection.InsertMany(new[] { new Parent { Model = new Model { Foo = "abc", Bar = 1, Baz = true } }, @@ -207,34 +260,33 @@ public async Task GetItems_With_Paging__DescSorting_AllItems_Are_Returned_DescSo .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IReadOnlyQueryRequest request = QueryRequestBuilder.New() + var request = QueryRequestBuilder.New() .SetQuery( "{ paging(order_by: { model: { foo: DESC } }) " + "{ nodes { model { foo } } } }") .Create(); // act - IExecutionResult result = await executor.ExecuteAsync(request); + var result = await executor.ExecuteAsync(request); // assert Assert.Null(result.ExpectQueryResult().Errors); - result.MatchSnapshot(); + result.ToJson().MatchSnapshot(); } - [Fact] public async Task GetItems_OnRenamedField_DescSorting_AllItems_Are_Returned_DescSorted() { // arrange IServiceProvider services = new ServiceCollection() - .AddSingleton>(sp => + .AddSingleton(_ => { - IMongoDatabase database = _mongoResource.CreateDatabase(); - IMongoCollection collection = database.GetCollection("col"); + var database = _mongoResource.CreateDatabase(); + var collection = database.GetCollection("col"); collection.InsertMany(new[] { new Parent { Model = new Model { Foo = "abc", Bar = 1, Baz = true } }, @@ -247,20 +299,20 @@ public async Task GetItems_OnRenamedField_DescSorting_AllItems_Are_Returned_Desc .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IReadOnlyQueryRequest request = QueryRequestBuilder.New() + var request = QueryRequestBuilder.New() .SetQuery("{ items(order_by: { model: { qux: DESC } }) { model { bar } } }") .Create(); // act - IExecutionResult result = await executor.ExecuteAsync(request); + var result = await executor.ExecuteAsync(request); // assert Assert.Null(result.ExpectQueryResult().Errors); - result.MatchSnapshot(); + result.ToJson().MatchSnapshot(); } public class QueryType : ObjectType diff --git a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/MongoSortingTests.cs b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/MongoSortingTests.cs index cdd51ac691e..7c6eb6c3814 100644 --- a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/MongoSortingTests.cs +++ b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/MongoSortingTests.cs @@ -26,10 +26,10 @@ public async Task GetItems_NoSorting_AllItems_Are_Returned_Unsorted() { // arrange IServiceProvider services = new ServiceCollection() - .AddSingleton>(sp => + .AddSingleton(_ => { - IMongoDatabase database = _mongoResource.CreateDatabase(); - IMongoCollection collection = database.GetCollection("col"); + var database = _mongoResource.CreateDatabase(); + var collection = database.GetCollection("col"); collection.InsertMany(new[] { new Model { Foo = "abc", Bar = 1, Baz = true }, @@ -42,20 +42,20 @@ public async Task GetItems_NoSorting_AllItems_Are_Returned_Unsorted() .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IReadOnlyQueryRequest request = QueryRequestBuilder.New() + var request = QueryRequestBuilder.New() .SetQuery("{ items { foo } }") .Create(); // act - IExecutionResult result = await executor.ExecuteAsync(request); + var result = await executor.ExecuteAsync(request); // assert Assert.Null(result.ExpectQueryResult().Errors); - result.MatchSnapshot(); + result.ToJson().MatchSnapshot(); } [Fact] @@ -63,10 +63,10 @@ public async Task GetItems_DescSorting_AllItems_Are_Returned_DescSorted() { // arrange IServiceProvider services = new ServiceCollection() - .AddSingleton>(sp => + .AddSingleton(_ => { - IMongoDatabase database = _mongoResource.CreateDatabase(); - IMongoCollection collection = database.GetCollection("col"); + var database = _mongoResource.CreateDatabase(); + var collection = database.GetCollection("col"); collection.InsertMany(new[] { new Model { Foo = "abc", Bar = 1, Baz = true }, @@ -79,20 +79,20 @@ public async Task GetItems_DescSorting_AllItems_Are_Returned_DescSorted() .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IReadOnlyQueryRequest request = QueryRequestBuilder.New() + var request = QueryRequestBuilder.New() .SetQuery("{ items(order_by: { foo: DESC }) { foo } }") .Create(); // act - IExecutionResult result = await executor.ExecuteAsync(request); + var result = await executor.ExecuteAsync(request); // assert Assert.Null(result.ExpectQueryResult().Errors); - result.MatchSnapshot(); + result.ToJson().MatchSnapshot(); } [Fact] @@ -100,10 +100,10 @@ public async Task GetItems_With_Paging__DescSorting_AllItems_Are_Returned_DescSo { // arrange IServiceProvider services = new ServiceCollection() - .AddSingleton>(sp => + .AddSingleton(_ => { - IMongoDatabase database = _mongoResource.CreateDatabase(); - IMongoCollection collection = database.GetCollection("col"); + var database = _mongoResource.CreateDatabase(); + var collection = database.GetCollection("col"); collection.InsertMany(new[] { new Model { Foo = "abc", Bar = 1, Baz = true }, @@ -116,20 +116,20 @@ public async Task GetItems_With_Paging__DescSorting_AllItems_Are_Returned_DescSo .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IReadOnlyQueryRequest request = QueryRequestBuilder.New() + var request = QueryRequestBuilder.New() .SetQuery("{ paging(order_by: { foo: DESC }) { nodes { foo } } }") .Create(); // act - IExecutionResult result = await executor.ExecuteAsync(request); + var result = await executor.ExecuteAsync(request); // assert Assert.Null(result.ExpectQueryResult().Errors); - result.MatchSnapshot(); + result.ToJson().MatchSnapshot(); } @@ -138,10 +138,10 @@ public async Task GetItems_OnRenamedField_DescSorting_AllItems_Are_Returned_Desc { // arrange IServiceProvider services = new ServiceCollection() - .AddSingleton>(sp => + .AddSingleton(_ => { - IMongoDatabase database = _mongoResource.CreateDatabase(); - IMongoCollection collection = database.GetCollection("col"); + var database = _mongoResource.CreateDatabase(); + var collection = database.GetCollection("col"); collection.InsertMany(new[] { new Model { Foo = "abc", Bar = 1, Baz = true }, @@ -154,20 +154,20 @@ public async Task GetItems_OnRenamedField_DescSorting_AllItems_Are_Returned_Desc .Services .BuildServiceProvider(); - IRequestExecutor executor = + var executor = await services.GetRequiredService() .GetRequestExecutorAsync(); - IReadOnlyQueryRequest request = QueryRequestBuilder.New() + var request = QueryRequestBuilder.New() .SetQuery("{ items(order_by: { qux: DESC }) { bar } }") .Create(); // act - IExecutionResult result = await executor.ExecuteAsync(request); + var result = await executor.ExecuteAsync(request); // assert Assert.Null(result.ExpectQueryResult().Errors); - result.MatchSnapshot(); + result.ToJson().MatchSnapshot(); } public class QueryType : ObjectType diff --git a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_DescSorting_AllItems_Are_Returned_DescSorted.snap b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_DescSorting_AllItems_Are_Returned_DescSorted.snap index 1202abe608d..916a5822ab1 100644 --- a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_DescSorting_AllItems_Are_Returned_DescSorted.snap +++ b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_DescSorting_AllItems_Are_Returned_DescSorted.snap @@ -1,8 +1,5 @@ { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { + "data": { "items": [ { "model": { @@ -15,9 +12,5 @@ } } ] - }, - "Errors": null, - "Extensions": null, - "ContextData": null, - "HasNext": null + } } diff --git a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_DescSorting_AllItems_Are_Returned_DescSortedOnNullable.snap b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_DescSorting_AllItems_Are_Returned_DescSortedOnNullable.snap index 4dc60376842..02c040f4d52 100644 --- a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_DescSorting_AllItems_Are_Returned_DescSortedOnNullable.snap +++ b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_DescSorting_AllItems_Are_Returned_DescSortedOnNullable.snap @@ -1,8 +1,5 @@ { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { + "data": { "items": [ { "model": { @@ -20,9 +17,5 @@ } } ] - }, - "Errors": null, - "Extensions": null, - "ContextData": null, - "HasNext": null + } } diff --git a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_DescSorting_AllItems_Are_Returned_DescSortedOnNullableObject.snap b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_DescSorting_AllItems_Are_Returned_DescSortedOnNullableObject.snap index 921ea5c1d2b..203f615fd73 100644 --- a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_DescSorting_AllItems_Are_Returned_DescSortedOnNullableObject.snap +++ b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_DescSorting_AllItems_Are_Returned_DescSortedOnNullableObject.snap @@ -1,8 +1,5 @@ { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { + "data": { "items": [ { "model": { @@ -18,9 +15,5 @@ "model": null } ] - }, - "Errors": null, - "Extensions": null, - "ContextData": null, - "HasNext": null + } } diff --git a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_NoSorting_AllItems_Are_Returned_Unsorted.snap b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_NoSorting_AllItems_Are_Returned_Unsorted.snap index 1c9c6584995..e427d9f26c6 100644 --- a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_NoSorting_AllItems_Are_Returned_Unsorted.snap +++ b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_NoSorting_AllItems_Are_Returned_Unsorted.snap @@ -1,8 +1,5 @@ { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { + "data": { "items": [ { "model": { @@ -15,9 +12,5 @@ } } ] - }, - "Errors": null, - "Extensions": null, - "ContextData": null, - "HasNext": null + } } diff --git a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_OnRenamedField_DescSorting_AllItems_Are_Returned_DescSorted.snap b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_OnRenamedField_DescSorting_AllItems_Are_Returned_DescSorted.snap index d14a2460d29..e6c8f304cc3 100644 --- a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_OnRenamedField_DescSorting_AllItems_Are_Returned_DescSorted.snap +++ b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_OnRenamedField_DescSorting_AllItems_Are_Returned_DescSorted.snap @@ -1,8 +1,5 @@ { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { + "data": { "items": [ { "model": { @@ -15,9 +12,5 @@ } } ] - }, - "Errors": null, - "Extensions": null, - "ContextData": null, - "HasNext": null + } } diff --git a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_With_Paging__DescSorting_AllItems_Are_Returned_DescSorted.snap b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_With_Paging__DescSorting_AllItems_Are_Returned_DescSorted.snap index 04cb8a198a4..364f65853ac 100644 --- a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_With_Paging__DescSorting_AllItems_Are_Returned_DescSorted.snap +++ b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingObjectTests.GetItems_With_Paging__DescSorting_AllItems_Are_Returned_DescSorted.snap @@ -1,8 +1,5 @@ { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { + "data": { "paging": { "nodes": [ { @@ -17,9 +14,5 @@ } ] } - }, - "Errors": null, - "Extensions": null, - "ContextData": null, - "HasNext": null + } } diff --git a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingTests.GetItems_DescSorting_AllItems_Are_Returned_DescSorted.snap b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingTests.GetItems_DescSorting_AllItems_Are_Returned_DescSorted.snap index 36c277d9e02..ac1d1ed80c4 100644 --- a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingTests.GetItems_DescSorting_AllItems_Are_Returned_DescSorted.snap +++ b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingTests.GetItems_DescSorting_AllItems_Are_Returned_DescSorted.snap @@ -1,8 +1,5 @@ { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { + "data": { "items": [ { "foo": "def" @@ -11,9 +8,5 @@ "foo": "abc" } ] - }, - "Errors": null, - "Extensions": null, - "ContextData": null, - "HasNext": null + } } diff --git a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingTests.GetItems_NoSorting_AllItems_Are_Returned_Unsorted.snap b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingTests.GetItems_NoSorting_AllItems_Are_Returned_Unsorted.snap index 8fad505d76d..16ed88f3ae9 100644 --- a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingTests.GetItems_NoSorting_AllItems_Are_Returned_Unsorted.snap +++ b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingTests.GetItems_NoSorting_AllItems_Are_Returned_Unsorted.snap @@ -1,8 +1,5 @@ { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { + "data": { "items": [ { "foo": "abc" @@ -11,9 +8,5 @@ "foo": "def" } ] - }, - "Errors": null, - "Extensions": null, - "ContextData": null, - "HasNext": null + } } diff --git a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingTests.GetItems_OnRenamedField_DescSorting_AllItems_Are_Returned_DescSorted.snap b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingTests.GetItems_OnRenamedField_DescSorting_AllItems_Are_Returned_DescSorted.snap index bdc64b14513..a021a9c2a8f 100644 --- a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingTests.GetItems_OnRenamedField_DescSorting_AllItems_Are_Returned_DescSorted.snap +++ b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingTests.GetItems_OnRenamedField_DescSorting_AllItems_Are_Returned_DescSorted.snap @@ -1,8 +1,5 @@ { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { + "data": { "items": [ { "bar": 2 @@ -11,9 +8,5 @@ "bar": 1 } ] - }, - "Errors": null, - "Extensions": null, - "ContextData": null, - "HasNext": null + } } diff --git a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingTests.GetItems_With_Paging__DescSorting_AllItems_Are_Returned_DescSorted.snap b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingTests.GetItems_With_Paging__DescSorting_AllItems_Are_Returned_DescSorted.snap index d86abb55ccb..d5fecd20630 100644 --- a/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingTests.GetItems_With_Paging__DescSorting_AllItems_Are_Returned_DescSorted.snap +++ b/src/HotChocolate/Filters/test/Types.Sorting.Mongo.Tests/__snapshots__/MongoSortingTests.GetItems_With_Paging__DescSorting_AllItems_Are_Returned_DescSorted.snap @@ -1,8 +1,5 @@ { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { + "data": { "paging": { "nodes": [ { @@ -13,9 +10,5 @@ } ] } - }, - "Errors": null, - "Extensions": null, - "ContextData": null, - "HasNext": null + } } diff --git a/src/HotChocolate/Language/test/Language.Tests/Parser/__snapshots__/KitchenSinkParserTests.ParseFacebookKitchenSinkQueryNullability_sdl.snap b/src/HotChocolate/Language/test/Language.Tests/Parser/__snapshots__/KitchenSinkParserTests.ParseFacebookKitchenSinkQueryNullability_sdl.snap index 35a8f5bd818..7f8912ad2f7 100644 --- a/src/HotChocolate/Language/test/Language.Tests/Parser/__snapshots__/KitchenSinkParserTests.ParseFacebookKitchenSinkQueryNullability_sdl.snap +++ b/src/HotChocolate/Language/test/Language.Tests/Parser/__snapshots__/KitchenSinkParserTests.ParseFacebookKitchenSinkQueryNullability_sdl.snap @@ -6,7 +6,7 @@ id alias: field1(first: 10, after: $foo) @include(if: $foo) { id - ... frag@onFragmentSpread + ... frag @onFragmentSpread } } field3! diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/HotChocolate.Data.MongoDb.Filters.Tests.csproj b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/HotChocolate.Data.MongoDb.Filters.Tests.csproj index e4c48c9f0fc..1af4300b2fe 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/HotChocolate.Data.MongoDb.Filters.Tests.csproj +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/HotChocolate.Data.MongoDb.Filters.Tests.csproj @@ -14,7 +14,7 @@ - + diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Paging.Tests/HotChocolate.Data.MongoDb.Paging.Tests.csproj b/src/HotChocolate/MongoDb/test/Data.MongoDb.Paging.Tests/HotChocolate.Data.MongoDb.Paging.Tests.csproj index 3013f4282d8..d39a2fafe78 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Paging.Tests/HotChocolate.Data.MongoDb.Paging.Tests.csproj +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Paging.Tests/HotChocolate.Data.MongoDb.Paging.Tests.csproj @@ -14,7 +14,7 @@ - + diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/HotChocolate.Data.MongoDb.Projections.Tests.csproj b/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/HotChocolate.Data.MongoDb.Projections.Tests.csproj index c7df44b954a..5cd1044c74c 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/HotChocolate.Data.MongoDb.Projections.Tests.csproj +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/HotChocolate.Data.MongoDb.Projections.Tests.csproj @@ -15,7 +15,7 @@ - + diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/HotChocolate.Data.MongoDb.Sorting.Tests.csproj b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/HotChocolate.Data.MongoDb.Sorting.Tests.csproj index 3d36ba7f0ae..1cfe5e697c4 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/HotChocolate.Data.MongoDb.Sorting.Tests.csproj +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/HotChocolate.Data.MongoDb.Sorting.Tests.csproj @@ -14,7 +14,7 @@ - + diff --git a/src/HotChocolate/MongoDb/test/Types.MongoDb/HotChocolate.Types.MongoDb.Tests.csproj b/src/HotChocolate/MongoDb/test/Types.MongoDb/HotChocolate.Types.MongoDb.Tests.csproj index d2855bb407d..0f3b37289a6 100644 --- a/src/HotChocolate/MongoDb/test/Types.MongoDb/HotChocolate.Types.MongoDb.Tests.csproj +++ b/src/HotChocolate/MongoDb/test/Types.MongoDb/HotChocolate.Types.MongoDb.Tests.csproj @@ -14,7 +14,7 @@ - + diff --git a/src/HotChocolate/Neo4J/test/HotChocolate.Data.Neo4J.Sorting.Tests/HotChocolate.Data.Neo4J.Sorting.Tests.csproj b/src/HotChocolate/Neo4J/test/HotChocolate.Data.Neo4J.Sorting.Tests/HotChocolate.Data.Neo4J.Sorting.Tests.csproj index a9a0dfd5e0d..bf285fe6b5f 100644 --- a/src/HotChocolate/Neo4J/test/HotChocolate.Data.Neo4J.Sorting.Tests/HotChocolate.Data.Neo4J.Sorting.Tests.csproj +++ b/src/HotChocolate/Neo4J/test/HotChocolate.Data.Neo4J.Sorting.Tests/HotChocolate.Data.Neo4J.Sorting.Tests.csproj @@ -5,9 +5,6 @@ HotChocolate.Data - - - diff --git a/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/HotChocolate.PersistedQueries.Redis.Tests.csproj b/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/HotChocolate.PersistedQueries.Redis.Tests.csproj index c06e6725f5f..1aa49daf0d7 100644 --- a/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/HotChocolate.PersistedQueries.Redis.Tests.csproj +++ b/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/HotChocolate.PersistedQueries.Redis.Tests.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/Extensions/TestExtensions.cs b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/Extensions/TestExtensions.cs index 8000b74041b..1d84b61af12 100644 --- a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/Extensions/TestExtensions.cs +++ b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/Extensions/TestExtensions.cs @@ -23,7 +23,7 @@ public static void MatchSqlSnapshot( { result.MatchSnapshot(snapshotName + postfix); if (result.ContextData is { } && - result.ContextData.TryGetValue("sql", out object? queryResult)) + result.ContextData.TryGetValue("sql", out var queryResult)) { queryResult.MatchSnapshot( new SnapshotNameExtension(snapshotName + "_sql" + postfix)); diff --git a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/Extensions/ToQueryStringExtensions.cs b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/Extensions/ToQueryStringExtensions.cs index 857a10cb306..6c303063d68 100644 --- a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/Extensions/ToQueryStringExtensions.cs +++ b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/Extensions/ToQueryStringExtensions.cs @@ -14,21 +14,21 @@ public static string ToQueryString( this IQueryable query) where TEntity : class { - IEnumerator? enumerator = query + var enumerator = query .Provider .Execute>(query.Expression) .GetEnumerator(); var relationalCommandCache = enumerator.Private("_relationalCommandCache"); - SelectExpression? selectExpression = relationalCommandCache + var selectExpression = relationalCommandCache .Private("_selectExpression"); - IQuerySqlGeneratorFactory? factory = relationalCommandCache + var factory = relationalCommandCache .Private("_querySqlGeneratorFactory"); - QuerySqlGenerator? sqlGenerator = factory.Create(); - IRelationalCommand? command = sqlGenerator.GetCommand(selectExpression); + var sqlGenerator = factory.Create(); + var command = sqlGenerator.GetCommand(selectExpression); var sql = command.CommandText; return sql; diff --git a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/FilterVisitorTestBase.cs b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/FilterVisitorTestBase.cs index 8f0aee0e0eb..620d6b3d33d 100644 --- a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/FilterVisitorTestBase.cs +++ b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/FilterVisitorTestBase.cs @@ -35,9 +35,9 @@ await _resource.RunSqlScriptAsync( "CREATE EXTENSION postgis;\n" + sql, databaseName); - DbSet set = dbContext.Set(); + var set = dbContext.Set(); - foreach (T result in results) + foreach (var result in results) { set.Add(result); await dbContext.SaveChangesAsync(); @@ -52,7 +52,7 @@ protected async Task CreateSchemaAsync( where TEntity : class where T : FilterInputType { - Func> resolver = + var resolver = await BuildResolverAsync(entities); return await new ServiceCollection() diff --git a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/HotChocolate.Spatial.Data.Filters.SqlServer.Tests.csproj b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/HotChocolate.Spatial.Data.Filters.SqlServer.Tests.csproj index 12a45f2e63e..c472c094fdb 100644 --- a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/HotChocolate.Spatial.Data.Filters.SqlServer.Tests.csproj +++ b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/HotChocolate.Spatial.Data.Filters.SqlServer.Tests.csproj @@ -16,7 +16,7 @@ - + diff --git a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorContainsTests.cs b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorContainsTests.cs index 4703a9d5504..f5c2e166d8c 100644 --- a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorContainsTests.cs +++ b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorContainsTests.cs @@ -45,11 +45,11 @@ public QueryableFilterVisitorContainsTests(PostgreSqlResource res public async Task Create_Contains_Expression() { // arrange - IRequestExecutor tester = await CreateSchemaAsync(_fooEntities); + var tester = await CreateSchemaAsync(_fooEntities); // act // assert - IExecutionResult res1 = await tester.ExecuteAsync( + var res1 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ @@ -70,7 +70,7 @@ public async Task Create_Contains_Expression() res1.MatchSqlSnapshot("1"); - IExecutionResult res2 = await tester.ExecuteAsync( + var res2 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ @@ -96,11 +96,11 @@ public async Task Create_Contains_Expression() public async Task Create_NotContains_Expression() { // arrange - IRequestExecutor tester = await CreateSchemaAsync(_fooEntities); + var tester = await CreateSchemaAsync(_fooEntities); // act // assert - IExecutionResult res1 = await tester.ExecuteAsync( + var res1 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ @@ -121,7 +121,7 @@ public async Task Create_NotContains_Expression() res1.MatchSqlSnapshot("2"); - IExecutionResult res2 = await tester.ExecuteAsync( + var res2 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ diff --git a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorDistanceTests.cs b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorDistanceTests.cs index 7102e526306..c605ca49643 100644 --- a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorDistanceTests.cs +++ b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorDistanceTests.cs @@ -45,11 +45,11 @@ public QueryableFilterVisitorDistanceTests(PostgreSqlResource res public async Task Create_Distance_Expression() { // arrange - IRequestExecutor tester = await CreateSchemaAsync(_fooEntities); + var tester = await CreateSchemaAsync(_fooEntities); // act // assert - IExecutionResult res1 = await tester.ExecuteAsync( + var res1 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ @@ -71,7 +71,7 @@ public async Task Create_Distance_Expression() res1.MatchSqlSnapshot("2"); - IExecutionResult res2 = await tester.ExecuteAsync( + var res2 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ diff --git a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorIntersectTests.cs b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorIntersectTests.cs index 54c7ea5aaf8..1c39cc4b7c8 100644 --- a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorIntersectTests.cs +++ b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorIntersectTests.cs @@ -45,11 +45,11 @@ public QueryableFilterVisitorIntersectsTests(PostgreSqlResource r public async Task Create_Intersects_Query() { // arrange - IRequestExecutor tester = await CreateSchemaAsync(_fooEntities); + var tester = await CreateSchemaAsync(_fooEntities); // act // assert - IExecutionResult res1 = await tester.ExecuteAsync( + var res1 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ @@ -78,7 +78,7 @@ [10 10] res1.MatchSqlSnapshot("true"); - IExecutionResult res2 = await tester.ExecuteAsync( + var res2 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ diff --git a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorOverlapsTests.cs b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorOverlapsTests.cs index f09e0c97658..27e6f94a105 100644 --- a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorOverlapsTests.cs +++ b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorOverlapsTests.cs @@ -47,11 +47,11 @@ public QueryableFilterVisitorOverlapsTests(PostgreSqlResource res public async Task Create_Overlaps_Query() { // arrange - IRequestExecutor tester = await CreateSchemaAsync(_fooEntities); + var tester = await CreateSchemaAsync(_fooEntities); // act // assert - IExecutionResult res1 = await tester.ExecuteAsync( + var res1 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ @@ -82,7 +82,7 @@ [150 150] res1.MatchSqlSnapshot("true"); - IExecutionResult res2 = await tester.ExecuteAsync( + var res2 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ diff --git a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorTouchesTests.cs b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorTouchesTests.cs index 1c42160c784..511c216bb27 100644 --- a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorTouchesTests.cs +++ b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorTouchesTests.cs @@ -46,11 +46,11 @@ public QueryableFilterVisitorTouchesTests(PostgreSqlResource reso public async Task Create_Touches_Query() { // arrange - IRequestExecutor tester = await CreateSchemaAsync(_fooEntities); + var tester = await CreateSchemaAsync(_fooEntities); // act // assert - IExecutionResult res1 = await tester.ExecuteAsync( + var res1 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ @@ -79,7 +79,7 @@ [240 80] res1.MatchSqlSnapshot("true"); - IExecutionResult res2 = await tester.ExecuteAsync( + var res2 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ diff --git a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorWithinTests.cs b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorWithinTests.cs index 64d91fdc762..ca80933c74f 100644 --- a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorWithinTests.cs +++ b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorWithinTests.cs @@ -45,11 +45,11 @@ public QueryableFilterVisitorWithinTests(PostgreSqlResource resou public async Task Create_Within_Query() { // arrange - IRequestExecutor tester = await CreateSchemaAsync(_fooEntities); + var tester = await CreateSchemaAsync(_fooEntities); // act // assert - IExecutionResult res1 = await tester.ExecuteAsync( + var res1 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ @@ -78,7 +78,7 @@ [20 20] res1.MatchSqlSnapshot("true"); - IExecutionResult res2 = await tester.ExecuteAsync( + var res2 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ diff --git a/src/HotChocolate/Spatial/test/Data.Projections.SqlServer.Tests/HotChocolate.Data.Projections.Spatial.SqlServer.Tests.csproj b/src/HotChocolate/Spatial/test/Data.Projections.SqlServer.Tests/HotChocolate.Data.Projections.Spatial.SqlServer.Tests.csproj index 9fa0e25c70b..1527d5ac401 100644 --- a/src/HotChocolate/Spatial/test/Data.Projections.SqlServer.Tests/HotChocolate.Data.Projections.Spatial.SqlServer.Tests.csproj +++ b/src/HotChocolate/Spatial/test/Data.Projections.SqlServer.Tests/HotChocolate.Data.Projections.Spatial.SqlServer.Tests.csproj @@ -16,7 +16,7 @@ - +