diff --git a/GraphQL.Client.sln b/GraphQL.Client.sln index 24ea23a4..ab95f2ec 100644 --- a/GraphQL.Client.sln +++ b/GraphQL.Client.sln @@ -33,9 +33,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Server.Test", "test EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{05CAF9B2-981E-40C0-AE31-5FA56E351F12}" ProjectSection(SolutionItems) = preProject - .github\workflows\branches-ubuntu.yml = .github\workflows\branches-ubuntu.yml .github\workflows\branches.yml = .github\workflows\branches.yml - .github\workflows\main.yml = .github\workflows\main.yml + .github\workflows\master.yml = .github\workflows\master.yml EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Primitives", "src\GraphQL.Primitives\GraphQL.Primitives.csproj", "{87FC440E-6A4D-47D8-9EB2-416FC31CC4A6}" @@ -64,7 +63,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Client.Serializer.S EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{89AD33AB-64F6-4F82-822F-21DF7A10CEC0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphQL.Client.Example", "examples\GraphQL.Client.Example\GraphQL.Client.Example.csproj", "{6B13B87D-1EF4-485F-BC5D-891E2F4DA6CD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Client.Example", "examples\GraphQL.Client.Example\GraphQL.Client.Example.csproj", "{6B13B87D-1EF4-485F-BC5D-891E2F4DA6CD}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/GraphQL.Primitives/GraphQLResponse.cs b/src/GraphQL.Primitives/GraphQLResponse.cs index 0b2781fd..24d3a4aa 100644 --- a/src/GraphQL.Primitives/GraphQLResponse.cs +++ b/src/GraphQL.Primitives/GraphQLResponse.cs @@ -6,11 +6,12 @@ namespace GraphQL { - public class GraphQLResponse : IEquatable?> + public class GraphQLResponse : IGraphQLResponse, IEquatable?> { [DataMember(Name = "data")] public T Data { get; set; } + object IGraphQLResponse.Data => Data; [DataMember(Name = "errors")] public GraphQLError[]? Errors { get; set; } diff --git a/src/GraphQL.Primitives/IGraphQLResponse.cs b/src/GraphQL.Primitives/IGraphQLResponse.cs new file mode 100644 index 00000000..789d686f --- /dev/null +++ b/src/GraphQL.Primitives/IGraphQLResponse.cs @@ -0,0 +1,11 @@ +namespace GraphQL +{ + public interface IGraphQLResponse + { + object Data { get; } + + GraphQLError[]? Errors { get; set; } + + Map? Extensions { get; set; } + } +} diff --git a/tests/GraphQL.Primitives.Tests/GraphQLRequestTest.cs b/tests/GraphQL.Primitives.Tests/GraphQLRequestTest.cs index 8fbda085..145ecfa6 100644 --- a/tests/GraphQL.Primitives.Tests/GraphQLRequestTest.cs +++ b/tests/GraphQL.Primitives.Tests/GraphQLRequestTest.cs @@ -75,8 +75,8 @@ public void InEquality1Fact() [Fact] public void InEquality2Fact() { - GraphQLRequest graphQLRequest1 = new GraphQLRequest("{hero{name}}", new { varName = "varValue1" }, "operationName"); - GraphQLRequest graphQLRequest2 = new GraphQLRequest("{hero{name}}", new { varName = "varValue2" }, "operationName"); + var graphQLRequest1 = new GraphQLRequest("{hero{name}}", new { varName = "varValue1" }, "operationName"); + var graphQLRequest2 = new GraphQLRequest("{hero{name}}", new { varName = "varValue2" }, "operationName"); Assert.NotEqual(graphQLRequest1, graphQLRequest2); } @@ -122,8 +122,11 @@ public void PropertyQueryGetFact() [Fact] public void PropertyQuerySetFact() { - var graphQLRequest = new GraphQLRequest("{hero{name}}", new { varName = "varValue1" }, "operationName"); - graphQLRequest.Query = "{hero{name2}}"; + var graphQLRequest = + new GraphQLRequest("{hero{name}}", new {varName = "varValue1"}, "operationName") + { + Query = "{hero{name2}}" + }; Assert.Equal("{hero{name2}}", graphQLRequest.Query); } @@ -144,8 +147,10 @@ public void PropertyOperationNameNullGetFact() [Fact] public void PropertyOperationNameSetFact() { - var graphQLRequest = new GraphQLRequest("{hero{name}}", new { varName = "varValue" }, "operationName1"); - graphQLRequest.OperationName = "operationName2"; + var graphQLRequest = new GraphQLRequest("{hero{name}}", new {varName = "varValue"}, "operationName1") + { + OperationName = "operationName2" + }; Assert.Equal("operationName2", graphQLRequest.OperationName); } @@ -166,10 +171,9 @@ public void PropertyVariableNullGetFact() [Fact] public void PropertyVariableSetFact() { - var graphQLRequest = new GraphQLRequest("{hero{name}}", new { varName = "varValue1" }, "operationName1"); - graphQLRequest.Variables = new + var graphQLRequest = new GraphQLRequest("{hero{name}}", new {varName = "varValue1"}, "operationName1") { - varName = "varValue2" + Variables = new {varName = "varValue2"} }; Assert.Equal(new {