|
1 | 1 | using System.ComponentModel; |
2 | 2 | using System.Globalization; |
| 3 | +using GraphQL.Conversion; |
3 | 4 |
|
4 | 5 | namespace DIObjectGraphTypeTests; |
5 | 6 |
|
@@ -128,10 +129,22 @@ public void IdNonNull() |
128 | 129 | { |
129 | 130 | Configure<CIdGraphType2, object>(); |
130 | 131 | VerifyFieldArgument("Field1", "arg", typeof(NonNullGraphType<IdGraphType>), "3"); |
131 | | - VerifyField("Field1", true, false, "3"); |
| 132 | + InitializeSchema(); |
| 133 | + VerifyField("Field1", typeof(StringGraphType), false, "3"); |
132 | 134 | Verify(false); |
133 | 135 | } |
134 | 136 |
|
| 137 | + private void InitializeSchema() |
| 138 | + { |
| 139 | + if (_graphType == null) |
| 140 | + throw new InvalidOperationException(); |
| 141 | + var schema = new Schema { Query = new ObjectGraphType() { Name = "Query" } }; |
| 142 | + schema.Query.AddField(new FieldType { Name = "dummy", Type = typeof(StringGraphType) }); |
| 143 | + schema.RegisterType(_graphType); |
| 144 | + schema.NameConverter = DefaultNameConverter.Instance; |
| 145 | + schema.Initialize(); |
| 146 | + } |
| 147 | + |
135 | 148 | public class CIdGraphType2 : DIObjectGraphBase |
136 | 149 | { |
137 | 150 | public static string? Field1([Id] int arg) => arg.ToString(CultureInfo.InvariantCulture); |
@@ -160,7 +173,7 @@ public void DefaultValue() |
160 | 173 | Configure<CDefaultValue, object>(); |
161 | 174 | VerifyFieldArgument("Field1", "arg1", false, 2); |
162 | 175 | VerifyField("Field1", false, false, 2); |
163 | | - VerifyFieldArgument<int>("Field2", "arg2", false); |
| 176 | + VerifyFieldArgument("Field2", "arg2", false, 5); // as of version 8, IResolveFieldContext.Arguments include the default values |
164 | 177 | VerifyField("Field2", false, false, 5); |
165 | 178 | Verify(false); |
166 | 179 | } |
|
0 commit comments