@@ -8,14 +8,83 @@ public class GraphQLClientPostTests : BaseGraphQLClientTest {
88
99 [ Fact ]
1010 public async void QueryPostAsyncFact ( ) {
11- var graphQLRequest = new GraphQLRequest { Query = @"
11+ var graphQLRequest = new GraphQLRequest {
12+ Query = @"
1213 {
1314 person(personID: ""1"") {
1415 name
1516 }
1617 }"
1718 } ;
18- var response = await this . GraphQLClient . PostAsync ( graphQLRequest ) . ConfigureAwait ( false ) ;
19+ var response = await this . GraphQLClient . PostAsync ( graphQLRequest ) . ConfigureAwait ( false ) ;
20+
21+ Assert . Equal ( "Luke Skywalker" , response . Data . person . name . Value ) ;
22+ Assert . Equal ( "Luke Skywalker" , response . GetDataFieldAs < Person > ( "person" ) . Name ) ;
23+ }
24+
25+ [ Fact ]
26+ public async void OperationNamePostAsyncFact ( ) {
27+ var graphQLRequest = new GraphQLRequest {
28+ Query = @"
29+ query Person{
30+ person(personID: ""1"") {
31+ name
32+ }
33+ }
34+
35+ query Planet {
36+ planet(planetID: ""1"") {
37+ name
38+ }
39+ }" ,
40+ OperationName = "Person"
41+ } ;
42+ var response = await this . GraphQLClient . PostAsync ( graphQLRequest ) . ConfigureAwait ( false ) ;
43+
44+ Assert . Equal ( "Luke Skywalker" , response . Data . person . name . Value ) ;
45+ Assert . Equal ( "Luke Skywalker" , response . GetDataFieldAs < Person > ( "person" ) . Name ) ;
46+ }
47+
48+ [ Fact ]
49+ public async void VariablesPostAsyncFact ( ) {
50+ var graphQLRequest = new GraphQLRequest {
51+ Query = @"
52+ query Person($personId: ID!){
53+ person(personID: $personId) {
54+ name
55+ }
56+ }" ,
57+ Variables = new {
58+ personId = "1"
59+ }
60+ } ;
61+ var response = await this . GraphQLClient . PostAsync ( graphQLRequest ) . ConfigureAwait ( false ) ;
62+
63+ Assert . Equal ( "Luke Skywalker" , response . Data . person . name . Value ) ;
64+ Assert . Equal ( "Luke Skywalker" , response . GetDataFieldAs < Person > ( "person" ) . Name ) ;
65+ }
66+
67+ [ Fact ]
68+ public async void OperationNameVariablePostAsyncFact ( ) {
69+ var graphQLRequest = new GraphQLRequest {
70+ Query = @"
71+ query Person($personId: ID!){
72+ person(personID: $personId) {
73+ name
74+ }
75+ }
76+
77+ query Planet {
78+ planet(planetID: ""1"") {
79+ name
80+ }
81+ }" ,
82+ OperationName = "Person" ,
83+ Variables = new {
84+ personId = "1"
85+ }
86+ } ;
87+ var response = await this . GraphQLClient . PostAsync ( graphQLRequest ) . ConfigureAwait ( false ) ;
1988
2089 Assert . Equal ( "Luke Skywalker" , response . Data . person . name . Value ) ;
2190 Assert . Equal ( "Luke Skywalker" , response . GetDataFieldAs < Person > ( "person" ) . Name ) ;
0 commit comments