diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/DataLoaderTests.cs b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/DataLoaderTests.cs index 54654b3ac32..09b6bdd38b1 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/DataLoaderTests.cs +++ b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/DataLoaderTests.cs @@ -1,16 +1,15 @@ using System.Collections.Immutable; using System.Diagnostics.CodeAnalysis; +using System.Diagnostics.Metrics; using CookieCrumble; using GreenDonut; using HotChocolate.Fetching; using HotChocolate.Resolvers; -using HotChocolate.Tests; using HotChocolate.Types; using HotChocolate.Types.Relay; using Microsoft.Extensions.DependencyInjection; -using Snapshooter.Xunit; using static HotChocolate.Tests.TestHelper; -using Snapshot = Snapshooter.Xunit.Snapshot; +using Snapshot = CookieCrumble.Snapshot; #nullable enable @@ -21,77 +20,93 @@ public class DataLoaderTests [Fact] public async Task FetchOnceDataLoader() { - Snapshot.FullName(); - await ExpectValid( + var snapshot = new Snapshot(); + + snapshot.Add( + await ExpectValid( "{ fetchItem }", configure: b => b .AddGraphQL() .AddDocumentFromString("type Query { fetchItem: String }") .ModifyRequestOptions(o => o.IncludeExceptionDetails = true) .AddResolver( - "Query", "fetchItem", + "Query", + "fetchItem", async ctx => await ctx.FetchOnceAsync(_ => Task.FromResult("fooBar"))) - ) - .MatchSnapshotAsync(); + )); + + snapshot.MatchMarkdown(); } [Fact] public async Task FetchSingleDataLoader() { - Snapshot.FullName(); - await ExpectValid( + var snapshot = new Snapshot(); + + snapshot.Add( + await ExpectValid( "{ fetchItem }", configure: b => b .AddGraphQL() .AddDocumentFromString("type Query { fetchItem: String }") .ModifyRequestOptions(o => o.IncludeExceptionDetails = true) .AddResolver( - "Query", "fetchItem", + "Query", + "fetchItem", async ctx => await ctx.CacheDataLoader( (key, _) => Task.FromResult(key)) .LoadAsync("fooBar")) - ) - .MatchSnapshotAsync(); + )); + + snapshot.MatchMarkdown(); } [LocalFact] public async Task FetchDataLoader() { - Snapshot.FullName(); - await ExpectValid( + var snapshot = new Snapshot(); + + snapshot.Add( + await ExpectValid( "{ fetchItem }", configure: b => b .AddGraphQL() .AddDocumentFromString("type Query { fetchItem: String }") .ModifyRequestOptions(o => o.IncludeExceptionDetails = true) .AddResolver( - "Query", "fetchItem", + "Query", + "fetchItem", async ctx => await ctx.BatchDataLoader( (keys, _) => Task.FromResult>( keys.ToDictionary(t => t))) .LoadAsync("fooBar")) - ) - .MatchSnapshotAsync(); + )); + + snapshot.MatchMarkdown(); } [Fact] public async Task FetchGroupDataLoader() { - Snapshot.FullName(); - await ExpectValid( + var snapshot = new Snapshot(); + + snapshot.Add( + await ExpectValid( "{ fetchItem }", configure: b => b .AddGraphQL() .AddDocumentFromString("type Query { fetchItem: String }") .ModifyRequestOptions(o => o.IncludeExceptionDetails = true) .AddResolver( - "Query", "fetchItem", + "Query", + "fetchItem", async ctx => await ctx.GroupDataLoader( (keys, _) => Task.FromResult( keys.ToLookup(t => t))) .LoadAsync("fooBar")) - ) - .MatchSnapshotAsync(); + )); + + snapshot.MatchMarkdown(); } [Fact] @@ -107,7 +122,8 @@ await ExpectValid( .AddDocumentFromString("type Query { fetchItem: String }") .ModifyRequestOptions(o => o.IncludeExceptionDetails = true) .AddResolver( - "Query", "fetchItem", + "Query", + "fetchItem", async ctx => await ctx.GroupDataLoader( (keys, _) => Task.FromResult( keys.ToLookup(t => t))) @@ -133,7 +149,8 @@ await ExpectValid( .AddDocumentFromString("type Query { fetchItem: String }") .ModifyRequestOptions(o => o.IncludeExceptionDetails = true) .AddResolver( - "Query", "fetchItem", + "Query", + "fetchItem", async ctx => await ctx.GroupDataLoader( (keys, _) => Task.FromResult( keys.ToLookup(t => t))) @@ -149,30 +166,34 @@ await ExpectValid( [Fact] public async Task ClassDataLoader() { - // arrange - var executor = await CreateExecutorAsync(c => c - .AddQueryType() - .AddDataLoader() - .ModifyRequestOptions(o => o.IncludeExceptionDetails = true) - .UseRequest(next => async context => - { - await next(context); + var snapshot = new Snapshot(); - var dataLoader = - context.Services - .GetRequiredService() - .GetDataLoader(() => throw new Exception()); - - context.Result = QueryResultBuilder - .FromResult(((IQueryResult)context.Result!)) - .AddExtension("loads", dataLoader.Loads) - .Create(); - }) - .UseDefaultPipeline()); + // arrange + var executor = await CreateExecutorAsync( + c => c + .AddQueryType() + .AddDataLoader() + .ModifyRequestOptions(o => o.IncludeExceptionDetails = true) + .UseRequest( + next => async context => + { + await next(context); + + var dataLoader = + context.Services + .GetRequiredService() + .GetDataLoader(() => throw new Exception()); + + context.Result = QueryResultBuilder + .FromResult(((IQueryResult)context.Result!)) + .AddExtension("loads", dataLoader.Loads) + .Create(); + }) + .UseDefaultPipeline()); // act - var results = new List - { + + snapshot.Add( await executor.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @@ -183,40 +204,42 @@ await executor.ExecuteAsync( c: withDataLoader(key: ""c"") } }") - .Create()), + .Create())); + snapshot.Add( await executor.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ a: withDataLoader(key: ""a"") }") - .Create()), + .Create())); + snapshot.Add( await executor.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ c: withDataLoader(key: ""c"") }") - .Create()), - }; + .Create())); // assert - SnapshotExtension.MatchSnapshot(results); + snapshot.MatchMarkdown(); } [LocalFact] public async Task StackedDataLoader() { + var snapshot = new Snapshot(); + // arrange - var executor = await CreateExecutorAsync(c => c - .AddQueryType() - .AddDataLoader() - .ModifyRequestOptions(o => o.IncludeExceptionDetails = true)); + var executor = await CreateExecutorAsync( + c => c + .AddQueryType() + .AddDataLoader() + .ModifyRequestOptions(o => o.IncludeExceptionDetails = true)); // act - var results = new List(); - - results.Add( + snapshot.Add( await executor.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @@ -226,7 +249,7 @@ await executor.ExecuteAsync( }") .Create())); - results.Add( + snapshot.Add( await executor.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @@ -235,7 +258,7 @@ await executor.ExecuteAsync( }") .Create())); - results.Add( + snapshot.Add( await executor.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @@ -245,34 +268,37 @@ await executor.ExecuteAsync( .Create())); // assert - SnapshotExtension.MatchSnapshot(results); + snapshot.MatchMarkdown(); } [Fact] public async Task ClassDataLoader_Resolve_From_DependencyInjection() { + var snapshot = new Snapshot(); + // arrange - var executor = await CreateExecutorAsync(c => c - .AddQueryType() - .AddDataLoader() - .ModifyRequestOptions(o => o.IncludeExceptionDetails = true) - .UseRequest(next => async context => - { - await next(context); + var executor = await CreateExecutorAsync( + c => c + .AddQueryType() + .AddDataLoader() + .ModifyRequestOptions(o => o.IncludeExceptionDetails = true) + .UseRequest( + next => async context => + { + await next(context); - var dataLoader = - (TestDataLoader)context.Services.GetRequiredService(); + var dataLoader = + (TestDataLoader)context.Services.GetRequiredService(); - context.Result = QueryResultBuilder - .FromResult(((IQueryResult)context.Result!)) - .AddExtension("loads", dataLoader.Loads) - .Create(); - }) - .UseDefaultPipeline()); + context.Result = QueryResultBuilder + .FromResult(((IQueryResult)context.Result!)) + .AddExtension("loads", dataLoader.Loads) + .Create(); + }) + .UseDefaultPipeline()); // act - var results = new List - { + snapshot.Add( await executor.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @@ -280,48 +306,52 @@ await executor.ExecuteAsync( a: dataLoaderWithInterface(key: ""a"") b: dataLoaderWithInterface(key: ""b"") }") - .Create()), + .Create())); + + snapshot.Add( await executor.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ a: dataLoaderWithInterface(key: ""a"") }") - .Create()), + .Create())); + + snapshot.Add( await executor.ExecuteAsync( QueryRequestBuilder.New() .SetQuery( @"{ c: dataLoaderWithInterface(key: ""c"") }") - .Create()), - }; + .Create())); // assert - SnapshotExtension.MatchSnapshot(results); + snapshot.MatchMarkdown(); } [LocalFact] public async Task NestedDataLoader() { + var snapshot = new Snapshot(); using var cts = new CancellationTokenSource(2000); - Snapshot.FullName(); + snapshot.Add( + await new ServiceCollection() + .AddGraphQL() + .AddQueryType() + .AddType() + .AddDataLoader() + .AddDataLoader() + .ExecuteRequestAsync("query Foo { foo { id field } }", cancellationToken: cts.Token)); - await new ServiceCollection() - .AddGraphQL() - .AddQueryType() - .AddType() - .AddDataLoader() - .AddDataLoader() - .ExecuteRequestAsync("query Foo { foo { id field } }", cancellationToken: cts.Token) - .MatchSnapshotAsync(); + snapshot.MatchMarkdown(); } [Fact] public async Task Ensure_That_DataLoader_Dispatch_Correctly_When_Used_Serially() { - Snapshot.FullName(); + var snapshot = new Snapshot(); var executor = await new ServiceCollection() @@ -332,13 +362,43 @@ public async Task Ensure_That_DataLoader_Dispatch_Correctly_When_Used_Serially() .ModifyOptions(o => o.StrictValidation = false) .BuildRequestExecutorAsync(); - var result = await executor.ExecuteAsync( - @"mutation { - a: doSomething(key: ""a"") - b: doSomething(key: ""b"") - }"); + snapshot.Add( + await executor.ExecuteAsync( + @"mutation { + a: doSomething(key: ""a"") + b: doSomething(key: ""b"") + }")); + + snapshot.MatchMarkdown(); + } + + [Fact] + public async Task DataLoader_Request_Ensures_That_There_Is_A_Single_Instance() + { + var snapshot = new Snapshot(); + + var executor = + await new ServiceCollection() + .AddScoped() + .AddGraphQLServer() + .AddQueryType() + .RegisterService(ServiceKind.Resolver) + .AddDataLoader() + .BuildRequestExecutorAsync(); - result.MatchSnapshot(); + snapshot.Add( + await executor.ExecuteAsync( + """ + { + a: do + b: do + c: do + d: do + e: do + } + """)); + + snapshot.MatchMarkdown(); } public class DataLoaderListener : DataLoaderDiagnosticEventListener @@ -360,7 +420,8 @@ public override IDisposable ExecuteBatch(IDataLoader dataLoader, IReadOnly return base.ExecuteBatch(dataLoader, keys); } - public override void BatchResults(IReadOnlyList keys, + public override void BatchResults( + IReadOnlyList keys, ReadOnlySpan> values) { BatchResultsTouched = true; @@ -434,9 +495,7 @@ public class FooNestedDataLoader : BatchDataLoader public FooNestedDataLoader( IBatchScheduler batchScheduler, DataLoaderOptions? options = null) - : base(batchScheduler, options) - { - } + : base(batchScheduler, options) { } protected override async Task> LoadBatchAsync( IReadOnlyList keys, @@ -475,9 +534,7 @@ public class CustomDataLoader : BatchDataLoader public CustomDataLoader( IBatchScheduler batchScheduler, DataLoaderOptions? options = null) - : base(batchScheduler, options) - { - } + : base(batchScheduler, options) { } protected override Task> LoadBatchAsync( IReadOnlyList keys, @@ -493,4 +550,35 @@ protected override Task> LoadBatchAsync( return Task.FromResult>(dict); } } -} + + public class CounterQuery + { + public Task Do(CounterService service) + => service.Do(); + } + + public class CounterService + { + private readonly CounterDataLoader _dataLoader; + + public CounterService(CounterDataLoader dataLoader) + { + _dataLoader = dataLoader; + } + + public async Task Do() => await _dataLoader.LoadAsync("abc"); + } + + public class CounterDataLoader : CacheDataLoader + { + public static int Counter; + + public CounterDataLoader(DataLoaderOptions? options = null) : base(options) + { + Interlocked.Increment(ref Counter); + } + + protected override Task LoadSingleAsync(string key, CancellationToken cancellationToken) + => Task.FromResult(key + Counter); + } +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/TestDataLoader.cs b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/TestDataLoader.cs index bad5d0a4048..0beac8924a1 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/TestDataLoader.cs +++ b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/TestDataLoader.cs @@ -2,13 +2,9 @@ namespace HotChocolate.Execution.Integration.DataLoader; -public class TestDataLoader : BatchDataLoader, ITestDataLoader +public class TestDataLoader(IBatchScheduler batchScheduler, DataLoaderOptions options) + : BatchDataLoader(batchScheduler, options), ITestDataLoader { - public TestDataLoader(IBatchScheduler batchScheduler, DataLoaderOptions options) - : base(batchScheduler, options) - { - } - public List> Loads { get; } = []; protected override async Task> LoadBatchAsync( diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader.md b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader.md new file mode 100644 index 00000000000..709d1500878 --- /dev/null +++ b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader.md @@ -0,0 +1,59 @@ +# ClassDataLoader + +## Result 1 + +```json +{ + "data": { + "a": "a", + "b": "b", + "bar": { + "c": "c" + } + }, + "extensions": { + "loads": [ + [ + "a", + "b", + "c" + ] + ] + } +} +``` + +## Result 2 + +```json +{ + "data": { + "a": "a" + }, + "extensions": { + "loads": [ + [ + "a" + ] + ] + } +} +``` + +## Result 3 + +```json +{ + "data": { + "c": "c" + }, + "extensions": { + "loads": [ + [ + "c" + ] + ] + } +} +``` + diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader.snap b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader.snap deleted file mode 100644 index d5f0ca74218..00000000000 --- a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader.snap +++ /dev/null @@ -1,71 +0,0 @@ -[ - { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { - "a": "a", - "b": "b", - "bar": { - "c": "c" - } - }, - "Items": null, - "Errors": null, - "Extensions": { - "loads": [ - [ - "a", - "b", - "c" - ] - ] - }, - "Incremental": null, - "ContextData": null, - "HasNext": null, - "IsDataSet": true - }, - { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { - "a": "a" - }, - "Items": null, - "Errors": null, - "Extensions": { - "loads": [ - [ - "a" - ] - ] - }, - "Incremental": null, - "ContextData": null, - "HasNext": null, - "IsDataSet": true - }, - { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { - "c": "c" - }, - "Items": null, - "Errors": null, - "Extensions": { - "loads": [ - [ - "c" - ] - ] - }, - "Incremental": null, - "ContextData": null, - "HasNext": null, - "IsDataSet": true - } -] diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoaderWithKey.snap b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoaderWithKey.snap deleted file mode 100644 index 4e51e804f16..00000000000 --- a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoaderWithKey.snap +++ /dev/null @@ -1,64 +0,0 @@ -[ - { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { - "a": "a", - "b": "b" - }, - "Items": null, - "Errors": null, - "Extensions": { - "loads": [ - [ - "a", - "b" - ] - ] - }, - "Incremental": null, - "ContextData": null, - "HasNext": null - }, - { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { - "a": "a" - }, - "Items": null, - "Errors": null, - "Extensions": { - "loads": [ - [ - "a" - ] - ] - }, - "Incremental": null, - "ContextData": null, - "HasNext": null - }, - { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { - "c": "c" - }, - "Items": null, - "Errors": null, - "Extensions": { - "loads": [ - [ - "c" - ] - ] - }, - "Incremental": null, - "ContextData": null, - "HasNext": null - } -] diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader_Resolve_From_DependencyInjection.md b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader_Resolve_From_DependencyInjection.md new file mode 100644 index 00000000000..0110f1d7116 --- /dev/null +++ b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader_Resolve_From_DependencyInjection.md @@ -0,0 +1,55 @@ +# ClassDataLoader_Resolve_From_DependencyInjection + +## Result 1 + +```json +{ + "data": { + "a": "a", + "b": "b" + }, + "extensions": { + "loads": [ + [ + "a", + "b" + ] + ] + } +} +``` + +## Result 2 + +```json +{ + "data": { + "a": "a" + }, + "extensions": { + "loads": [ + [ + "a" + ] + ] + } +} +``` + +## Result 3 + +```json +{ + "data": { + "c": "c" + }, + "extensions": { + "loads": [ + [ + "c" + ] + ] + } +} +``` + diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader_Resolve_From_DependencyInjection.snap b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader_Resolve_From_DependencyInjection.snap deleted file mode 100644 index fcab9c092a0..00000000000 --- a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader_Resolve_From_DependencyInjection.snap +++ /dev/null @@ -1,67 +0,0 @@ -[ - { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { - "a": "a", - "b": "b" - }, - "Items": null, - "Errors": null, - "Extensions": { - "loads": [ - [ - "a", - "b" - ] - ] - }, - "Incremental": null, - "ContextData": null, - "HasNext": null, - "IsDataSet": true - }, - { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { - "a": "a" - }, - "Items": null, - "Errors": null, - "Extensions": { - "loads": [ - [ - "a" - ] - ] - }, - "Incremental": null, - "ContextData": null, - "HasNext": null, - "IsDataSet": true - }, - { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { - "c": "c" - }, - "Items": null, - "Errors": null, - "Extensions": { - "loads": [ - [ - "c" - ] - ] - }, - "Incremental": null, - "ContextData": null, - "HasNext": null, - "IsDataSet": true - } -] diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader_Resolve_From_DependencyInjection_NETCOREAPP2_1.snap b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader_Resolve_From_DependencyInjection_NETCOREAPP2_1.snap deleted file mode 100644 index ce03a704184..00000000000 --- a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader_Resolve_From_DependencyInjection_NETCOREAPP2_1.snap +++ /dev/null @@ -1,46 +0,0 @@ -[ - { - "Data": { - "a": "a", - "b": "b" - }, - "Errors": null, - "Extensions": { - "loads": [ - [ - "a", - "b" - ] - ] - }, - "ContextData": null - }, - { - "Data": { - "a": "a" - }, - "Errors": null, - "Extensions": { - "loads": [ - [ - "a" - ] - ] - }, - "ContextData": null - }, - { - "Data": { - "c": "c" - }, - "Errors": null, - "Extensions": { - "loads": [ - [ - "c" - ] - ] - }, - "ContextData": null - } -] diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.DataLoader_Request_Ensures_That_There_Is_A_Single_Instance.md b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.DataLoader_Request_Ensures_That_There_Is_A_Single_Instance.md new file mode 100644 index 00000000000..bcca48eb24b --- /dev/null +++ b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.DataLoader_Request_Ensures_That_There_Is_A_Single_Instance.md @@ -0,0 +1,13 @@ +# DataLoader_Request_Ensures_That_There_Is_A_Single_Instance + +```json +{ + "data": { + "a": "abc1", + "b": "abc1", + "c": "abc1", + "d": "abc1", + "e": "abc1" + } +} +``` diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.Ensure_That_DataLoader_Dispatch_Correctly_When_Used_Serially.md b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.Ensure_That_DataLoader_Dispatch_Correctly_When_Used_Serially.md new file mode 100644 index 00000000000..0c43d072aaa --- /dev/null +++ b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.Ensure_That_DataLoader_Dispatch_Correctly_When_Used_Serially.md @@ -0,0 +1,10 @@ +# Ensure_That_DataLoader_Dispatch_Correctly_When_Used_Serially + +```json +{ + "data": { + "a": "a_value", + "b": "b_value" + } +} +``` diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.Ensure_That_DataLoader_Dispatch_Correctly_When_Used_Serially.snap b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.Ensure_That_DataLoader_Dispatch_Correctly_When_Used_Serially.snap deleted file mode 100644 index b899e8bc341..00000000000 --- a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.Ensure_That_DataLoader_Dispatch_Correctly_When_Used_Serially.snap +++ /dev/null @@ -1,6 +0,0 @@ -{ - "data": { - "a": "a_value", - "b": "b_value" - } -} diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.FetchDataLoader.snap b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.FetchGroupDataLoader.md similarity index 53% rename from src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.FetchDataLoader.snap rename to src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.FetchGroupDataLoader.md index 38fbfcca920..65d9849bd46 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.FetchDataLoader.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.FetchGroupDataLoader.md @@ -1,5 +1,9 @@ -{ +# FetchGroupDataLoader + +```json +{ "data": { "fetchItem": "fooBar" } } +``` diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.FetchSingleDataLoader.snap b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.FetchOnceDataLoader.md similarity index 54% rename from src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.FetchSingleDataLoader.snap rename to src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.FetchOnceDataLoader.md index 38fbfcca920..5363a59f28d 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.FetchSingleDataLoader.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.FetchOnceDataLoader.md @@ -1,5 +1,9 @@ -{ +# FetchOnceDataLoader + +```json +{ "data": { "fetchItem": "fooBar" } } +``` diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.FetchOnceDataLoader.snap b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.FetchOnceDataLoader.snap deleted file mode 100644 index 38fbfcca920..00000000000 --- a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.FetchOnceDataLoader.snap +++ /dev/null @@ -1,5 +0,0 @@ -{ - "data": { - "fetchItem": "fooBar" - } -} diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.FetchGroupDataLoader.snap b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.FetchSingleDataLoader.md similarity index 53% rename from src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.FetchGroupDataLoader.snap rename to src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.FetchSingleDataLoader.md index 38fbfcca920..a8eefccc450 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.FetchGroupDataLoader.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.FetchSingleDataLoader.md @@ -1,5 +1,9 @@ -{ +# FetchSingleDataLoader + +```json +{ "data": { "fetchItem": "fooBar" } } +``` diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.NestedDataLoader.snap b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.NestedDataLoader.snap deleted file mode 100644 index d111a5b7b84..00000000000 --- a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.NestedDataLoader.snap +++ /dev/null @@ -1,8 +0,0 @@ -{ - "data": { - "foo": { - "id": "Rm9vCmRoZWxsbw==", - "field": "hello" - } - } -} diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.StackedDataLoader.snap b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.StackedDataLoader.snap deleted file mode 100644 index 0c7effbf745..00000000000 --- a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.StackedDataLoader.snap +++ /dev/null @@ -1,45 +0,0 @@ -[ - { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { - "a": "aaabacadaeafagah", - "b": "babbbcbdbebfbgbh" - }, - "Items": null, - "Errors": null, - "Extensions": null, - "Incremental": null, - "ContextData": null, - "HasNext": null - }, - { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { - "a": "aaabacadaeafagah" - }, - "Items": null, - "Errors": null, - "Extensions": null, - "Incremental": null, - "ContextData": null, - "HasNext": null - }, - { - "Kind": "SingleResult", - "Label": null, - "Path": null, - "Data": { - "c": "cacbcccdcecfcgch" - }, - "Items": null, - "Errors": null, - "Extensions": null, - "Incremental": null, - "ContextData": null, - "HasNext": null - } -] diff --git a/src/HotChocolate/Core/test/Subscriptions.InMemory.Tests/InMemoryIntegrationTests.cs b/src/HotChocolate/Core/test/Subscriptions.InMemory.Tests/InMemoryIntegrationTests.cs index 568d2bfa14a..3c08e10a32b 100644 --- a/src/HotChocolate/Core/test/Subscriptions.InMemory.Tests/InMemoryIntegrationTests.cs +++ b/src/HotChocolate/Core/test/Subscriptions.InMemory.Tests/InMemoryIntegrationTests.cs @@ -37,11 +37,11 @@ public override Task Subscribe_Topic_With_Arguments_2_Topics() [Fact] public override Task Subscribe_Topic_With_2_Arguments() => base.Subscribe_Topic_With_2_Arguments(); - + [Fact] public override Task Subscribe_And_Complete_Topic() => base.Subscribe_And_Complete_Topic(); - + [Fact] public override Task Subscribe_And_Complete_Topic_With_ValueTypeMessage() => base.Subscribe_And_Complete_Topic_With_ValueTypeMessage();