-
-
Notifications
You must be signed in to change notification settings - Fork 804
Expand file tree
/
Copy pathStarWarsUnionListTest.cs
More file actions
40 lines (34 loc) · 1.39 KB
/
StarWarsUnionListTest.cs
File metadata and controls
40 lines (34 loc) · 1.39 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
39
40
using HotChocolate.AspNetCore.Tests.Utilities;
using Microsoft.Extensions.DependencyInjection;
using StrawberryShake.Transport.WebSockets;
namespace StrawberryShake.CodeGeneration.CSharp.Integration.StarWarsUnionList;
public class StarWarsUnionListTest : ServerTestBase
{
public StarWarsUnionListTest(TestServerFactory serverFactory) : base(serverFactory)
{
}
[Fact]
public async Task Execute_StarWarsUnionList_Test()
{
// arrange
using var cts = new CancellationTokenSource(20_000);
using var host = TestServerHelper.CreateServer(
_ => { },
out var port);
var serviceCollection = new ServiceCollection();
serviceCollection.AddHttpClient(
StarWarsUnionListClient.ClientName,
c => c.BaseAddress = new Uri("http://localhost:" + port + "/graphql"));
serviceCollection.AddWebSocketClient(
StarWarsUnionListClient.ClientName,
c => c.Uri = new Uri("ws://localhost:" + port + "/graphql"));
serviceCollection.AddStarWarsUnionListClient();
IServiceProvider services = serviceCollection.BuildServiceProvider();
var client = services.GetRequiredService<StarWarsUnionListClient>();
// act
var result = await client.SearchHero.ExecuteAsync(cts.Token);
// assert
result.EnsureNoErrors();
result.Data.MatchSnapshot();
}
}