|
1 |
| -using System; |
2 | 1 | using System.Collections.Generic;
|
3 | 2 | using System.IO;
|
4 | 3 | using System.Linq;
|
@@ -62,45 +61,22 @@ public void StringToInputs()
|
62 | 61 | Verify(actual);
|
63 | 62 | }
|
64 | 63 |
|
65 |
| - [Fact] |
66 |
| - public void FromJson() |
67 |
| - { |
68 |
| - var test = $"{{\"query\":\"hello\",\"variables\":{_exampleJson}}}"; |
69 |
| - var actual = test.FromJson<TestClass1>(); |
70 |
| - actual.query.ShouldBe("hello"); |
71 |
| - Verify(actual.variables); |
72 |
| - } |
73 |
| - |
74 | 64 | [Fact]
|
75 | 65 | public void FromJson_Null()
|
76 | 66 | {
|
77 | 67 | var test = $"{{\"query\":\"hello\",\"variables\":null}}";
|
78 |
| - var actual = test.FromJson<TestClass1>(); |
79 |
| - actual.query.ShouldBe("hello"); |
80 |
| - actual.variables.ShouldBeNull(); |
| 68 | + var actual = test.FromJson<TestClass3>(); |
| 69 | + actual.Query.ShouldBe("hello"); |
| 70 | + actual.Variables.ShouldBeNull(); |
81 | 71 | }
|
82 | 72 |
|
83 | 73 | [Fact]
|
84 | 74 | public void FromJson_Missing()
|
85 | 75 | {
|
86 | 76 | var test = $"{{\"query\":\"hello\"}}";
|
87 |
| - var actual = test.FromJson<TestClass1>(); |
88 |
| - actual.query.ShouldBe("hello"); |
89 |
| - actual.variables.ShouldBeNull(); |
90 |
| - } |
91 |
| - |
92 |
| - [Fact] |
93 |
| - public async Task FromJsonAsync() |
94 |
| - { |
95 |
| - var test = $"{{\"query\":\"hello\",\"variables\":{_exampleJson}}}"; |
96 |
| - var testData = new MemoryStream(Encoding.UTF8.GetBytes(test)); |
97 |
| - var actual = await testData.FromJsonAsync<TestClass1>(); |
98 |
| - actual.query.ShouldBe("hello"); |
99 |
| - Verify(actual.variables); |
100 |
| - // verify that the stream has not been disposed |
101 |
| - testData.ReadByte().ShouldBe(-1); |
102 |
| - testData.Dispose(); |
103 |
| - Should.Throw<ObjectDisposedException>(() => testData.ReadByte()); |
| 77 | + var actual = test.FromJson<TestClass3>(); |
| 78 | + actual.Query.ShouldBe("hello"); |
| 79 | + actual.Variables.ShouldBeNull(); |
104 | 80 | }
|
105 | 81 |
|
106 | 82 | [Fact]
|
@@ -198,12 +174,6 @@ public void ToInputsReturnsEmptyForNull()
|
198 | 174 | ((string)null).ToInputs().ShouldNotBeNull().Count.ShouldBe(0);
|
199 | 175 | }
|
200 | 176 |
|
201 |
| - private class TestClass1 |
202 |
| - { |
203 |
| - public string query { get; set; } |
204 |
| - public Dictionary<string, object> variables { get; set; } |
205 |
| - } |
206 |
| - |
207 | 177 | private class TestClass2
|
208 | 178 | {
|
209 | 179 | public string Query { get; set; }
|
|
0 commit comments