コード例 #1
0
        public void TestSimple()
        {
            var query = GraphQuery.Parse("test");

            Assert.That(query, Is.Not.Null);
            Assert.That(query.ObjectType, Is.EqualTo("test"));
            Assert.That(query.Filters, Is.Not.Null);
            Assert.That(query.Filters.Count, Is.EqualTo(0));
            Assert.That(query.Fields, Is.Not.Null);
            Assert.That(query.Fields.Count(), Is.EqualTo(0));
        }
コード例 #2
0
        public void TestOneField()
        {
            var query = GraphQuery.Parse("test { foo }");

            Assert.That(query, Is.Not.Null);
            Assert.That(query.ObjectType, Is.EqualTo("test"));
            Assert.That(query.Filters, Is.Not.Null);
            Assert.That(query.Filters.Count, Is.EqualTo(0));
            Assert.That(query.Fields, Is.Not.Null);
            Assert.That(query.Fields.Count(), Is.EqualTo(1));
            var field = query.Fields.First();

            Assert.That(field.FieldName, Is.EqualTo("foo"));
            Assert.That(field.NestedFields, Is.Not.Null);
            Assert.That(field.NestedFields.Count(), Is.EqualTo(0));
        }
コード例 #3
0
        public void TestTwoFilters()
        {
            var query = GraphQuery.Parse("test (id:1, type:3) { foo }");

            Assert.That(query, Is.Not.Null);
            Assert.That(query.ObjectType, Is.EqualTo("test"));
            Assert.That(query.Filters, Is.Not.Null);
            Assert.That(query.Filters.Count, Is.EqualTo(2));
            Assert.That(query.Filters["id"], Is.EqualTo("1"));
            Assert.That(query.Filters["type"], Is.EqualTo("3"));
            Assert.That(query.Fields, Is.Not.Null);
            Assert.That(query.Fields.Count(), Is.EqualTo(1));
            var field = query.Fields.First();

            Assert.That(field.FieldName, Is.EqualTo("foo"));
            Assert.That(field.NestedFields, Is.Not.Null);
            Assert.That(field.NestedFields.Count(), Is.EqualTo(0));
        }
コード例 #4
0
        public void TestTwoFields()
        {
            var query = GraphQuery.Parse("test { foo, bar }");

            Assert.That(query, Is.Not.Null);
            Assert.That(query.ObjectType, Is.EqualTo("test"));
            Assert.That(query.Filters, Is.Not.Null);
            Assert.That(query.Filters.Count, Is.EqualTo(0));
            Assert.That(query.Fields, Is.Not.Null);
            Assert.That(query.Fields.Count(), Is.EqualTo(2));
            var field = query.Fields.First();

            Assert.That(field.FieldName, Is.EqualTo("foo"));
            Assert.That(field.NestedFields, Is.Not.Null);
            Assert.That(field.NestedFields.Count(), Is.EqualTo(0));
            field = query.Fields.ElementAt(1);
            Assert.That(field.FieldName, Is.EqualTo("bar"));
            Assert.That(field.NestedFields, Is.Not.Null);
            Assert.That(field.NestedFields.Count(), Is.EqualTo(0));
        }