示例#1
0
        public async Task TestIntrospection()
        {
            TestEnv.LogTestMethodStart();
            TestEnv.LogTestDescr(" retriving starship and its type name");

            var query = @"
query { 
  starship(id: ""3001"") {
    name 
    length
    __typename
  } 
} ";
            var resp  = await TestEnv.Client.PostAsync(query);

            resp.EnsureNoErrors();
            var ship = resp.data.starship;

            Assert.IsNotNull(ship);
            var typeName = ship.__typename;

            Assert.AreEqual("Starship", typeName);

            TestEnv.LogTestDescr("Retrieving Starhip type.");
            query = @"
query { 
  type: __type(name: ""Starship"") {
    name 
    kind
  } 
} ";
            resp  = await TestEnv.Client.PostAsync(query);

            resp.EnsureNoErrors();
            var type = resp.GetTopField <__Type>("type");

            Assert.IsNotNull(type);
            Assert.AreEqual(TypeKind.Object, type.Kind);
        }
示例#2
0
 public void TestInit()
 {
     TestEnv.Initialize();
 }