public void AddGraphQL_ServicesSchemaConfigure_SchemaNull()
        {
            // arrange
            // act
            Action action = () => ServiceCollectionExtensions.AddGraphQL(
                new ServiceCollection(),
                default(Schema),
                new Action <IQueryExecutionBuilder>(c => { }));

            // assert
            Assert.Throws <ArgumentNullException>(action);
        }
Exemplo n.º 2
0
        public void AddGraphQL_ServicesSchemaFactory_ServiceNull()
        {
            // arrange
            var schema = Schema.Create(c => c.Options.StrictValidation = false);

            // act
            Action action = () => ServiceCollectionExtensions.AddGraphQL(
                null, new Func <IServiceProvider, ISchema>(s => schema));

            // assert
            Assert.Throws <ArgumentNullException>(action);
        }
        public void AddGraphQL_ServicesSchemaConfigOptions_SchemaNull()
        {
            // arrange
            // act
            Action action = () => ServiceCollectionExtensions.AddGraphQL(
                new ServiceCollection(),
                default(Action <ISchemaConfiguration>),
                new QueryExecutionOptions());

            // assert
            Assert.Throws <ArgumentNullException>(action);
        }
        public void AddGraphQL_ServicesSchemaFactoryOptions_SchemaNull()
        {
            // arrange
            // act
            Action action = () => ServiceCollectionExtensions.AddGraphQL(
                new ServiceCollection(),
                default(Func <IServiceProvider, ISchema>),
                new QueryExecutionOptions());

            // assert
            Assert.Throws <ArgumentNullException>(action);
        }
        public void AddGraphQL_ServicesSchemaSdlConfigure_SchemaSdlEmpty()
        {
            // arrange
            // act
            Action action = () => ServiceCollectionExtensions.AddGraphQL(
                new ServiceCollection(),
                string.Empty,
                new Action <ISchemaConfiguration>(c => { }));

            // assert
            Assert.Throws <ArgumentNullException>(action);
        }
        public void AddGraphQL_ServicesSchema_ServiceNull()
        {
            // arrange
            var schema = Schema.Create(c => c.Options.StrictValidation = false);

            // act
            Action action = () => ServiceCollectionExtensions.AddGraphQL(
                null, schema);

            // assert
            Assert.Throws <ArgumentNullException>(action);
        }
        public void AddGraphQL_ServicesSchemaSdlConfigure_ServiceNull()
        {
            // arrange
            // act
            Action action = () => ServiceCollectionExtensions.AddGraphQL(
                null,
                "type Query { a: String }",
                new Action <ISchemaConfiguration>(c => { }));

            // assert
            Assert.Throws <ArgumentNullException>(action);
        }
Exemplo n.º 8
0
        public void AddGraphQL_ServicesConfigureBuilder_ConfigureNull()
        {
            // arrange
            // act
            Action action = () => ServiceCollectionExtensions.AddGraphQL(
                new ServiceCollection(),
                default(Action <ISchemaConfiguration>),
                new Func <IQueryExecutionBuilder, IQueryExecutionBuilder>(
                    b => b));

            // assert
            Assert.Throws <ArgumentNullException>(action);
        }
Exemplo n.º 9
0
        public void AddGraphQL_ServicesSchemaSdlConfigureBld_BuilderNull()
        {
            // arrange
            // act
            Action action = () => ServiceCollectionExtensions.AddGraphQL(
                new ServiceCollection(),
                "type Query { a: String }",
                new Action <ISchemaConfiguration>(c => { }),
                default(Action <IQueryExecutionBuilder>));

            // assert
            Assert.Throws <ArgumentNullException>(action);
        }
Exemplo n.º 10
0
        public void AddGraphQL_ServicesSchemaConfigure_ServiceNull()
        {
            // arrange
            var schema = Schema.Create(c => c.Options.StrictValidation = false);

            // act
            Action action = () => ServiceCollectionExtensions.AddGraphQL(
                null,
                schema,
                new Action <IQueryExecutionBuilder>(c => { }));

            // assert
            Assert.Throws <ArgumentNullException>(action);
        }
Exemplo n.º 11
0
        public void AddGraphQL_ServicesSchemaConfigOptions_OptionsNull()
        {
            // arrange
            var schema = Schema.Create(c => c.Options.StrictValidation = false);

            // act
            Action action = () => ServiceCollectionExtensions.AddGraphQL(
                new ServiceCollection(),
                new Action <ISchemaConfiguration>(c => { }),
                default(IQueryExecutionOptionsAccessor));

            // assert
            Assert.Throws <ArgumentNullException>(action);
        }
Exemplo n.º 12
0
        public void AddGraphQL_ServicesSchemaFactoryBuilder_BuilderNull()
        {
            // arrange
            var schema = Schema.Create(c => c.Options.StrictValidation = false);

            // act
            Action action = () => ServiceCollectionExtensions.AddGraphQL(
                new ServiceCollection(),
                new Func <IServiceProvider, ISchema>(s => schema),
                default(Action <IQueryExecutionBuilder>));

            // assert
            Assert.Throws <ArgumentNullException>(action);
        }
Exemplo n.º 13
0
        public void AddGraphQL_ServicesSchemaSdlConfigure_ConfigureNull()
        {
            // arrange
            var schema = Schema.Create(c => c.Options.StrictValidation = false);

            // act
            Action action = () => ServiceCollectionExtensions.AddGraphQL(
                new ServiceCollection(),
                "type Query { a: String }",
                default(Action <ISchemaConfiguration>));

            // assert
            Assert.Throws <ArgumentNullException>(action);
        }
Exemplo n.º 14
0
        public void AddGraphQL_ServicesSchemaConfigureBuilder_ServiceNull()
        {
            // arrange
            // act
            Action action = () => ServiceCollectionExtensions.AddGraphQL(
                null,
                "type Query { a: String }",
                new Action <ISchemaConfiguration>(c => { }),
                new Func <IQueryExecutionBuilder, IQueryExecutionBuilder>(
                    b => b));

            // assert
            Assert.Throws <ArgumentNullException>(action);
        }
Exemplo n.º 15
0
        public void AddGraphQL_ServicesSchemaConfigureBuilder_BuilderNull()
        {
            // arrange
            var schema = Schema.Create(c => c.Options.StrictValidation = false);

            // act
            Action action = () => ServiceCollectionExtensions.AddGraphQL(
                new ServiceCollection(),
                "type Query { a: String }",
                new Action <ISchemaConfiguration>(c => { }),
                default(Func <IQueryExecutionBuilder, IQueryExecutionBuilder>));

            // assert
            Assert.Throws <ArgumentNullException>(action);
        }
Exemplo n.º 16
0
        public void AddGraphQL_ServicesSchema()
        {
            // arrange
            var services = new ServiceCollection();
            var schema   = Schema.Create(c => c.Options.StrictValidation = false);

            // act
            ServiceCollectionExtensions.AddGraphQL(
                services,
                schema);

            // assert
            services.Select(t => ReflectionUtils.GetTypeName(t.ServiceType))
            .OrderBy(t => t, StringComparer.Ordinal)
            .ToArray()
            .MatchSnapshot();
        }
Exemplo n.º 17
0
        public void AddGraphQL_ServicesSchemaConfigOptions()
        {
            // arrange
            var services = new ServiceCollection();
            var options  = new QueryExecutionOptions();

            // act
            ServiceCollectionExtensions.AddGraphQL(
                services,
                c => c.Options.StrictValidation = false,
                options);

            // assert
            services.Select(t => ReflectionUtils.GetTypeName(t.ServiceType))
            .OrderBy(t => t, StringComparer.Ordinal)
            .ToArray()
            .MatchSnapshot();
        }
Exemplo n.º 18
0
        public void AddGraphQL_ServicesSchemaBuilder()
        {
            // arrange
            var services = new ServiceCollection();

            // act
            ServiceCollectionExtensions.AddGraphQL(
                services,
                SchemaBuilder.New()
                .AddDocumentFromString("type Query { a: String }")
                .Use(next => context => default(ValueTask)));

            // assert
            services.Select(t => ReflectionUtils.GetTypeName(t.ServiceType))
            .OrderBy(t => t, StringComparer.Ordinal)
            .ToArray()
            .MatchSnapshot();
        }
Exemplo n.º 19
0
        public void AddGraphQL_ServicesSchemaSdlConfigure()
        {
            // arrange
            var    services  = new ServiceCollection();
            string schema    = "type Query { a: String }";
            var    schemaCfg = new Action <ISchemaConfiguration>(
                c => c.Options.StrictValidation = false);

            // act
            ServiceCollectionExtensions.AddGraphQL(
                services,
                schema,
                schemaCfg);

            // assert
            services.Select(t => ReflectionUtils.GetTypeName(t.ServiceType))
            .OrderBy(t => t, StringComparer.Ordinal)
            .ToArray()
            .MatchSnapshot();
        }
Exemplo n.º 20
0
        public void AddGraphQL_ServicesSchemaFactoryBuilder()
        {
            // arrange
            var services = new ServiceCollection();
            var schema   = Schema.Create(c => c.Options.StrictValidation = false);
            var cfg      = new Action <IQueryExecutionBuilder>(
                c => c.UseDefaultPipeline());

            // act
            ServiceCollectionExtensions.AddGraphQL(
                services,
                sp => schema,
                cfg);

            // assert
            services.Select(t => ReflectionUtils.GetTypeName(t.ServiceType))
            .OrderBy(t => t, StringComparer.Ordinal)
            .ToArray()
            .MatchSnapshot();
        }
Exemplo n.º 21
0
        public void AddGraphQL_ServicesSchemaConfigureBuilder()
        {
            // arrange
            var services  = new ServiceCollection();
            var schema    = "type Query { a: String }";
            var schemaCfg = new Action <ISchemaConfiguration>(
                c => c.Options.StrictValidation = false);
            var cfg = new Func <IQueryExecutionBuilder, IQueryExecutionBuilder>(
                c => c.UseDefaultPipeline());

            // act
            ServiceCollectionExtensions.AddGraphQL(
                services,
                schema,
                schemaCfg,
                cfg);

            // assert
            services.Select(t => ReflectionUtils.GetTypeName(t.ServiceType))
            .OrderBy(t => t, StringComparer.Ordinal)
            .ToArray()
            .MatchSnapshot();
        }