Example #1
0
        public async Task ShouldExportNullableField_Gitub()
        {
            var settings = settingsLoader.GenerateSettings(new CodeGeneratorSettingsLoaderDefaults(), new[] { "./Files/Issue_9/QueryGithub.gql" });

            CodeGenerator generator = new CodeGenerator(logger, settings.Single());

            await generator.LoadSource();

            generator.Parse();
            generator.Render();

            var code = generator.GeneratedCode;

            Assert.Contains("int? DatabaseId { get; ", code);
            Assert.Contains("DateTime CreatedAt { get; ", code);
        }
Example #2
0
        public async Task ClientOnlyDirectivesShouldBeTrimedFromQueries()
        {
            var settings = settingsLoader.GenerateSettings(new CodeGeneratorSettingsLoaderDefaults(), new[] { "./Files/ClientOnlyDirectives/Query.gql" });

            CodeGenerator generator = new CodeGenerator(logger, settings.Single());

            await generator.LoadSource();

            generator.Parse();
            generator.Render();

            Assert.Empty(generator.Document.Errors);

            var code = generator.GeneratedCode;

            Assert.Contains(@"query q {
  test(id: """"safsa""""){
    nullable
    nonnullable
  }
}".Trim().Replace("\r", ""), code.Replace("\r", ""));
        }