예제 #1
0
        public void Check_Simple_Mutation_Single_Field()
        {
            var fields = new[]
            {
                new GraphQLField("alias", "field", null, null),
            };
            var fieldBuilder   = new FieldBuilderMock(fields);
            var queryGenerator = new GraphQLQueryGeneratorFromFields();
            var expected       = "{\"query\":\"mutation{alias:field}\"}";

            var actual = queryGenerator.GetMutation <string>(fieldBuilder); // Typeparameter is ignored since it just returns the fields

            Assert.Equal(expected, actual);
        }
예제 #2
0
        public void Check_Simple_Mutation_Single_Field()
        {
            var fieldBuilderMock = A.Fake <IGraphQLFieldBuilder>(x => x.Strict());

            A.CallTo(() => fieldBuilderMock.GenerateSelectionSet(typeof(string)))
            .Returns(new GraphQLField[]
            {
                new GraphQLField("alias", "field", null, null),
            });
            var queryGenerator = new GraphQLQueryGeneratorFromFields();
            var expected       = "{\"query\":\"mutation{alias:field}\"}";

            var actual = queryGenerator.GetMutation <string>(fieldBuilderMock);

            Assert.Equal(expected, actual);
        }