コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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();
        }
コード例 #6
0
        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();
        }
コード例 #7
0
        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);
        }
コード例 #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();
        }
コード例 #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();
        }
コード例 #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);
        }