public void MapCustomDirectiveToDifferentType()
        {
            // arrange
            ISchema       schema        = CreateSchema();
            DirectiveType directiveType = schema.GetDirectiveType("Foo");
            var           fooDirective  = new FooDirective
            {
                Bar   = "123",
                Child = new FooChild
                {
                    Bar = "456"
                }
            };

            // act
            var directive = Directive.FromDescription(
                directiveType,
                new DirectiveDefinition(
                    fooDirective,
                    _typeInspector.GetTypeRef(fooDirective.GetType())),
                new object());
            FooChild mappedObject = directive.ToObject <FooChild>();

            // assert
            Assert.Equal("123", mappedObject.Bar);
        }
Ejemplo n.º 2
0
        public void MapCustomDirectiveToDifferentType()
        {
            // arrange
            ISchema       schema        = CreateSchema();
            DirectiveType directiveType = schema.GetDirectiveType("Foo");
            var           fooDirective  = new FooDirective
            {
                Bar   = "123",
                Child = new FooChild
                {
                    Bar = "456"
                }
            };

            // act
            var directive = new Directive(
                directiveType, fooDirective, new object());
            FooChild mappedObject = directive.ToObject <FooChild>();

            // assert
            Assert.Equal("123", mappedObject.Bar);
        }
 public void Setup()
 {
     _testEntities = new TestEntities();
     _parent = new FooParent();
     _child = new FooChild();
 }