-
-
Notifications
You must be signed in to change notification settings - Fork 804
Expand file tree
/
Copy pathStarWarsIntrospectionTest.cs
More file actions
38 lines (33 loc) · 1.38 KB
/
StarWarsIntrospectionTest.cs
File metadata and controls
38 lines (33 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using HotChocolate.AspNetCore.Tests.Utilities;
using Microsoft.Extensions.DependencyInjection;
using StrawberryShake.Transport.WebSockets;
namespace StrawberryShake.CodeGeneration.CSharp.Integration.StarWarsIntrospection;
public class StarWarsIntrospectionTest : ServerTestBase
{
public StarWarsIntrospectionTest(TestServerFactory serverFactory) : base(serverFactory)
{
}
[Fact]
public async Task Execute_StarWarsIntrospection_Test()
{
// arrange
var ct = new CancellationTokenSource(20_000).Token;
using var host = TestServerHelper.CreateServer(
_ => { },
out var port);
var serviceCollection = new ServiceCollection();
serviceCollection.AddHttpClient(
StarWarsIntrospectionClient.ClientName,
c => c.BaseAddress = new Uri("http://localhost:" + port + "/graphql"));
serviceCollection.AddWebSocketClient(
StarWarsIntrospectionClient.ClientName,
c => c.Uri = new Uri("ws://localhost:" + port + "/graphql"));
serviceCollection.AddStarWarsIntrospectionClient();
IServiceProvider services = serviceCollection.BuildServiceProvider();
var client = services.GetRequiredService<StarWarsIntrospectionClient>();
// act
var result = await client.IntrospectionQuery.ExecuteAsync(ct);
// assert
result.MatchSnapshot();
}
}