public async Task Download_Schema_AST_HttpClient_Is_Null()
        {
            // arrange
            var introspectionClient = new IntrospectionClient();

            // act
            Func <Task> action = () => introspectionClient.DownloadSchemaAsync(null);

            // assert
            await Assert.ThrowsAsync <ArgumentNullException>(action);
        }
        public async Task GetSchemaFeatures_HttpClient_Is_Null()
        {
            // arrange
            var introspectionClient = new IntrospectionClient();

            // act
            Func <Task> action = () => introspectionClient.GetSchemaFeaturesAsync(null);

            // assert
            await Assert.ThrowsAsync <ArgumentNullException>(action);
        }
        public async Task Download_Schema_SDL_HttpClient_Is_Null()
        {
            // arrange
            var introspectionClient = new IntrospectionClient();

            using var stream = new MemoryStream();

            // act
            Func <Task> action = () => introspectionClient.DownloadSchemaAsync(null, stream);

            // assert
            await Assert.ThrowsAsync <ArgumentNullException>(action);
        }
        public async Task Download_Schema_SDL_Stream_Is_Null()
        {
            // arrange
            TestServer server = CreateStarWarsServer();
            var        introspectionClient = new IntrospectionClient();

            // act
            Func <Task> action = () =>
                                 introspectionClient.DownloadSchemaAsync(server.CreateClient(), null);

            // assert
            await Assert.ThrowsAsync <ArgumentNullException>(action);
        }
        public async Task Download_Schema_AST()
        {
            // arrange
            TestServer server = CreateStarWarsServer();
            var        introspectionClient = new IntrospectionClient();

            // act
            DocumentNode schema =
                await introspectionClient.DownloadSchemaAsync(
                    server.CreateClient());

            // assert
            SchemaSyntaxSerializer.Serialize(schema, true).MatchSnapshot();
        }
        public async Task Download_Schema_SDL()
        {
            // arrange
            TestServer server = CreateStarWarsServer();
            var        introspectionClient = new IntrospectionClient();

            using var stream = new MemoryStream();

            // act
            await introspectionClient.DownloadSchemaAsync(
                server.CreateClient(), stream);

            // assert
            Encoding.UTF8.GetString(stream.ToArray()).MatchSnapshot();
        }
        public async Task GetSchemaFeatures()
        {
            // arrange
            TestServer server = CreateStarWarsServer();
            var        introspectionClient = new IntrospectionClient();

            // act
            ISchemaFeatures features =
                await introspectionClient.GetSchemaFeaturesAsync(
                    server.CreateClient());

            // assert
            Assert.True(features.HasDirectiveLocations);
            Assert.True(features.HasRepeatableDirectives);
            Assert.True(features.HasSubscriptionSupport);
        }
Ejemplo n.º 8
0
        public async Task Download_Schema_AST()
        {
            // arrange
            TestServer server = CreateStarWarsServer();
            HttpClient client = server.CreateClient();

            client.BaseAddress = new Uri("http://localhost:5000/graphql");

            var introspectionClient = new IntrospectionClient();

            // act
            DocumentNode schema = await introspectionClient.DownloadSchemaAsync(client);

            // assert
            schema.ToString(true).MatchSnapshot();
        }
Ejemplo n.º 9
0
        public async Task Download_Schema_SDL()
        {
            // arrange
            TestServer server = CreateStarWarsServer();
            HttpClient client = server.CreateClient();

            client.BaseAddress = new Uri("http://localhost:5000/graphql");

            var introspectionClient = new IntrospectionClient();

            using var stream = new MemoryStream();

            // act
            await introspectionClient.DownloadSchemaAsync(client, stream);

            // assert
            Encoding.UTF8.GetString(stream.ToArray()).MatchSnapshot();
        }
Ejemplo n.º 10
0
        public async Task GetSchemaFeatures()
        {
            // arrange
            TestServer server = CreateStarWarsServer();
            HttpClient client = server.CreateClient();

            client.BaseAddress = new Uri("http://localhost:5000/graphql");

            var introspectionClient = new IntrospectionClient();

            // act
            ISchemaFeatures features = await introspectionClient.GetSchemaFeaturesAsync(client);

            // assert
            Assert.True(features.HasDirectiveLocations);
            Assert.True(features.HasRepeatableDirectives);
            Assert.True(features.HasSubscriptionSupport);
        }