Skip to content

Commit

Permalink
Fixed Mutation Executor issue
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib committed Oct 18, 2020
1 parent 68a5a1f commit f925bfe
Show file tree
Hide file tree
Showing 21 changed files with 69 additions and 30 deletions.
Expand Up @@ -48,6 +48,11 @@ internal sealed class MutationExecutor
scopedContext));

await ExecuteTasksAsync(operationContext).ConfigureAwait(false);

if (i + 1 < selections.Count)
{
operationContext.Execution.Reset();
}
}
}

Expand Down
Expand Up @@ -2,17 +2,16 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using GreenDonut;
using HotChocolate.DataLoader;
using HotChocolate.Execution;
using HotChocolate.Resolvers;
using HotChocolate.Tests;
using Microsoft.Extensions.DependencyInjection;
using Snapshooter.Xunit;
using Xunit;
using static HotChocolate.Tests.TestHelper;

namespace HotChocolate.Integration.DataLoader
namespace HotChocolate.Execution.Integration.DataLoader
{
public class DataLoaderTests
{
Expand Down
@@ -1,6 +1,6 @@
using GreenDonut;

namespace HotChocolate.Integration.DataLoader
namespace HotChocolate.Execution.Integration.DataLoader
{
public interface ITestDataLoader
: IDataLoader<string, string>
Expand Down
@@ -1,7 +1,7 @@
namespace HotChocolate.Integration.DataLoader
namespace HotChocolate.Execution.Integration.DataLoader
{
public class MyCustomContext
{
{
public int Count { get; set; }
}
}
Expand Up @@ -2,7 +2,7 @@
using System.Threading.Tasks;
using HotChocolate.Language;

namespace HotChocolate.Integration.DataLoader
namespace HotChocolate.Execution.Integration.DataLoader
{
public class Query
{
Expand Down
Expand Up @@ -4,7 +4,7 @@
using System.Threading.Tasks;
using GreenDonut;

namespace HotChocolate.Integration.DataLoader
namespace HotChocolate.Execution.Integration.DataLoader
{
public class TestDataLoader
: DataLoaderBase<string, string>
Expand Down
@@ -1,6 +1,6 @@
using HotChocolate.Types;

namespace HotChocolate.Integration.Directives
namespace HotChocolate.Execution.Integration.Directives
{
public class ConstantDirectiveType
: DirectiveType
Expand Down
@@ -1,11 +1,10 @@
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using HotChocolate.Execution;
using Snapshooter.Xunit;
using Xunit;
using static HotChocolate.Tests.TestHelper;

namespace HotChocolate.Integration.Directives
namespace HotChocolate.Execution.Integration.Directives
{
public class DirectiveIntegrationTests
{
Expand Down
@@ -1,12 +1,12 @@
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using HotChocolate.Tests;
using HotChocolate.Types;
using Microsoft.Extensions.DependencyInjection;
using Snapshooter.Xunit;
using Xunit;
using static HotChocolate.Tests.TestHelper;

namespace HotChocolate.Integration.EmbeddedResolvers
namespace HotChocolate.Execution.Integration.EmbeddedResolvers
{
public class EmbeddedResolverTests
{
Expand Down
@@ -1,4 +1,4 @@
namespace HotChocolate.Integration.HelloWorldCodeFirst
namespace HotChocolate.Execution.Integration.HelloWorldCodeFirst
{
public class DataStoreHelloWorld
{
Expand Down
@@ -1,11 +1,11 @@
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using HotChocolate.Tests;
using Microsoft.Extensions.DependencyInjection;
using Snapshooter.Xunit;
using Xunit;
using static HotChocolate.Tests.TestHelper;

namespace HotChocolate.Integration.HelloWorldCodeFirst
namespace HotChocolate.Execution.Integration.HelloWorldCodeFirst
{
public class HelloWorldCodeFirstTests
{
Expand Down
@@ -1,6 +1,6 @@
using HotChocolate.Types;

namespace HotChocolate.Integration.HelloWorldCodeFirst
namespace HotChocolate.Execution.Integration.HelloWorldCodeFirst
{
public class MutationHelloWorld
: ObjectType
Expand Down
@@ -1,6 +1,6 @@
using HotChocolate.Types;

namespace HotChocolate.Integration.HelloWorldCodeFirst
namespace HotChocolate.Execution.Integration.HelloWorldCodeFirst
{
public class QueryHelloWorld
: ObjectType
Expand Down
@@ -1,4 +1,4 @@
namespace HotChocolate.Integration.HelloWorldCodeFirst
namespace HotChocolate.Execution.Integration.HelloWorldCodeFirst
{
public class QueryHelloWorldClr
{
Expand Down
@@ -1,12 +1,12 @@
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using HotChocolate.Resolvers;
using HotChocolate.Tests;
using Microsoft.Extensions.DependencyInjection;
using Snapshooter.Xunit;
using Xunit;
using static HotChocolate.Tests.TestHelper;

namespace HotChocolate.Integration.HelloWorldSchemaFirst
namespace HotChocolate.Execution.Integration.HelloWorldSchemaFirst
{
public class HelloWorldSchemaFirstTests
{
Expand Down
@@ -1,10 +1,9 @@
using System.Threading.Tasks;
using HotChocolate.Execution;
using HotChocolate.Types;
using Snapshooter.Xunit;
using Xunit;

namespace HotChocolate.Integration.InputOutputObjectAreTheSame
namespace HotChocolate.Execution.Integration.InputOutputObjectAreTheSame
{
public class InputOutputObjectAreTheSame
{
Expand Down
@@ -1,4 +1,4 @@
namespace HotChocolate.Integration.InputOutputObjectAreTheSame
namespace HotChocolate.Execution.Integration.InputOutputObjectAreTheSame
{
public class Person
{
Expand Down
@@ -1,4 +1,4 @@
namespace HotChocolate.Integration.InputOutputObjectAreTheSame
namespace HotChocolate.Execution.Integration.InputOutputObjectAreTheSame
{
public class Query
{
Expand Down
@@ -1,15 +1,14 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using HotChocolate.Execution;
using HotChocolate.Language;
using HotChocolate.Tests;
using Microsoft.Extensions.DependencyInjection;
using Snapshooter;
using Snapshooter.Xunit;
using Xunit;
using static HotChocolate.Tests.TestHelper;

namespace HotChocolate.Integration.StarWarsCodeFirst
namespace HotChocolate.Execution.Integration.StarWarsCodeFirst
{
public class StarWarsCodeFirstTests
{
Expand Down Expand Up @@ -309,6 +308,32 @@ public async Task GraphQLOrgMutationExample()
.MatchSnapshotAsync();
}

[Fact]
public async Task GraphQLOrgTwoMutationsExample()
{
Snapshot.FullName();
await ExpectValid(@"
mutation CreateReviewForEpisode(
$ep: Episode!, $ep2: Episode!, $review: ReviewInput!) {
createReview(episode: $ep, review: $review) {
stars
commentary
}
b: createReview(episode: $ep2, review: $review) {
stars
commentary
}
}",
request: r => r
.SetVariableValue("ep", new EnumValueNode("JEDI"))
.SetVariableValue("ep2", new EnumValueNode("JEDI"))
.SetVariableValue("review", new ObjectValueNode(
new ObjectFieldNode("stars", new IntValueNode(5)),
new ObjectFieldNode("commentary",
new StringValueNode("This is a great movie!")))))
.MatchSnapshotAsync();
}

[Fact]
public async Task GraphQLOrgMutationExample_With_ValueVariables()
{
Expand Down
@@ -0,0 +1,12 @@
{
"data": {
"createReview": {
"stars": 5,
"commentary": "This is a great movie!"
},
"b": {
"stars": 5,
"commentary": "This is a great movie!"
}
}
}
@@ -1,15 +1,15 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using HotChocolate.Tests;
using HotChocolate.Types;
using HotChocolate.Utilities;
using Microsoft.Extensions.DependencyInjection;
using Snapshooter.Xunit;
using Xunit;
using static HotChocolate.Tests.TestHelper;

namespace HotChocolate.Integration.TypeConverter
namespace HotChocolate.Execution.Integration.TypeConverter
{
public class TypeConverterTests
{
Expand Down

0 comments on commit f925bfe

Please sign in to comment.