Пример #1
0
        public void ReturnsActualName()
        {
            var schema = new TestObjectGraphSchema();

            Assert.Equal("id", schema.GetActualFieldName("Project", "id", null));
            Assert.Equal("name", schema.GetActualFieldName("Project", "name", null));
        }
 public void RemovesTypeAndFields2()
 {
     var schema = new TestObjectGraphSchema();
     Assert.Equal("id", schema.GetActualFieldName("Project", "id", null));
     schema.RemoveTypeAndAllFields("Project");
     Assert.Empty(schema.GetQueryFields().Where(s => s.GetReturnType(schema) == "project"));
 }
Пример #3
0
        public void ReturnsActualName()
        {
            var schema = new TestObjectGraphSchema();

            Assert.Equal("Id", schema.GetActualFieldName("project", "ID"));
            Assert.Equal("Name".ToLower(), schema.GetActualFieldName("project", "NAme").ToLower());
        }
 public void ExposesDefinedFields()
 {
     var provider = new TestObjectGraphSchema();
     Assert.Equal(true, provider.TypeHasField("opentask", "id"));
     Assert.Equal(true, provider.TypeHasField("opentask", "description"));
     // Name is not exposed in our schema
     Assert.Equal(false, provider.TypeHasField("opentask", "name"));
 }
 public void ExposesDefinedFields()
 {
     var provider = new TestObjectGraphSchema();
     Assert.True(provider.TypeHasField("Person", "id", new string[0], null));
     Assert.True(provider.TypeHasField("Person", "name", new string[0], null));
     // Not exposed in our schema
     Assert.True(provider.TypeHasField("Person", "fullName", new string[0], null));
 }
 public void ExposesFieldsFromObjectWhenNotDefined()
 {
     var provider = new TestObjectGraphSchema();
     Assert.Equal(true, provider.TypeHasField("location", "id"));
     Assert.Equal(true, provider.TypeHasField("location", "address"));
     Assert.Equal(true, provider.TypeHasField("location", "state"));
     Assert.Equal(true, provider.TypeHasField("location", "Country"));
     Assert.Equal(true, provider.TypeHasField("location", "planet"));
 }
Пример #7
0
        public void ExposesDefinedFields()
        {
            var provider = new TestObjectGraphSchema();

            Assert.True(provider.TypeHasField("opentask", "id", new string[0]));
            Assert.True(provider.TypeHasField("opentask", "assignee", new string[0]));
            // Not exposed in our schema
            Assert.False(provider.TypeHasField("opentask", "IsActive", new string[0]));
        }
 public void SupportsEnum()
 {
     var schema = new TestObjectGraphSchema();
     Assert.Equal("Gender", schema.Type("Gender").Name);
     Assert.True(schema.Type("Gender").IsEnum);
     Assert.Equal(4, schema.Type("Gender").GetFields().Count());
     Assert.Equal("__typename", schema.Type("Gender").GetFields().ElementAt(0).Name);
     Assert.Equal("Female", schema.Type("Gender").GetFields().ElementAt(1).Name);
 }
 public void ExposesFieldsFromObjectWhenNotDefined()
 {
     var provider = new TestObjectGraphSchema();
     Assert.True(provider.TypeHasField("Location", "id", new string[0], null));
     Assert.True(provider.TypeHasField("Location", "address", new string[0], null));
     Assert.True(provider.TypeHasField("Location", "state", new string[0], null));
     Assert.True(provider.TypeHasField("Location", "country", new string[0], null));
     Assert.True(provider.TypeHasField("Location", "planet", new string[0], null));
 }
Пример #10
0
        public void CompilesIdentityCallFullPath()
        {
            var schema = new TestObjectGraphSchema();
            var exp    = EqlCompiler.Compile("privateProjects.where(id = 8).count()", schema);

            Assert.Equal(0, exp.Execute(GetDataContext()));
            var exp2 = EqlCompiler.Compile("privateProjects.count()", schema);

            Assert.Equal(1, exp2.Execute(GetDataContext()));
        }
        public void ExposesFieldsFromObjectWhenNotDefined()
        {
            var provider = new TestObjectGraphSchema();

            Assert.True(provider.TypeHasField("location", "id"));
            Assert.True(provider.TypeHasField("location", "address"));
            Assert.True(provider.TypeHasField("location", "state"));
            Assert.True(provider.TypeHasField("location", "Country"));
            Assert.True(provider.TypeHasField("location", "planet"));
        }
Пример #12
0
        public void ReadsContextType()
        {
            var provider = new TestObjectGraphSchema();

            Assert.Equal(typeof(TestDataContext), provider.ContextType);
        }
 public void ReturnsActualName()
 {
     var schema = new TestObjectGraphSchema();
     Assert.Equal("Id", schema.GetActualFieldName("project", "ID"));
     Assert.Equal("Name", schema.GetActualFieldName("project", "NAme"));
 }
 public void ReadsContextType()
 {
     var provider = new TestObjectGraphSchema();
     Assert.Equal(typeof(TestDataContext), provider.ContextType);
 }