Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions GraphQL.Client.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/GraphQL.Primitives/GraphQLResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
namespace GraphQL
{

public class GraphQLResponse<T> : IEquatable<GraphQLResponse<T>?>
public class GraphQLResponse<T> : IGraphQLResponse, IEquatable<GraphQLResponse<T>?>
{

[DataMember(Name = "data")]
public T Data { get; set; }
object IGraphQLResponse.Data => Data;

[DataMember(Name = "errors")]
public GraphQLError[]? Errors { get; set; }
Expand Down
11 changes: 11 additions & 0 deletions src/GraphQL.Primitives/IGraphQLResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace GraphQL
{
public interface IGraphQLResponse
{
object Data { get; }

GraphQLError[]? Errors { get; set; }

Map? Extensions { get; set; }
}
}
22 changes: 13 additions & 9 deletions tests/GraphQL.Primitives.Tests/GraphQLRequestTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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
{
Expand Down