Exemplo n.º 1
0
        protected static ObjectFieldDescriptor CreateFieldDescriptor(
            Type sourceType, Type resolverType, MemberInfo member)
        {
            var fieldDescriptor = new ObjectFieldDescriptor(
                member, sourceType);

            if (resolverType != sourceType)
            {
                fieldDescriptor.ResolverType(resolverType);
            }

            return(fieldDescriptor);
        }
Exemplo n.º 2
0
        public void ResolverTypeIsSet()
        {
            // arrange
            var descriptor = new ObjectFieldDescriptor(
                typeof(ObjectField).GetProperty("Arguments"),
                typeof(ObjectField));

            // act
            descriptor.ResolverType(typeof(string));

            // assert
            ObjectFieldDescription description = descriptor.CreateDescription();

            Assert.Equal(typeof(ObjectField), description.SourceType);
            Assert.Equal(typeof(string), description.ResolverType);
        }