-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathUsage.cs
More file actions
49 lines (43 loc) · 1.44 KB
/
Usage.cs
File metadata and controls
49 lines (43 loc) · 1.44 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
41
42
43
44
45
46
47
48
49
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
#pragma warning disable ASPDEPR008
#pragma warning disable ASPDEPR004
public class Usage
{
static async Task Foo(HttpClient httpClient)
{
#region ClientFormSender
var clientFormSender = new ClientFormSender(httpClient);
await clientFormSender.Send(
route: "/SendMessage",
message: "{\"Property\": \"Value\"}",
typeName: "TheMessageType",
typeNamespace: "TheMessageNamespace",
destination: "TheDestination",
attachments: new()
{
{"fileName", "fileContents"u8.ToArray()}
});
#endregion
}
static async Task SubmitMultipartForm()
{
#region asptesthost
var hostBuilder = new WebHostBuilder();
hostBuilder.UseStartup<Startup>();
using var testServer = new TestServer(hostBuilder);
using var httpClient = testServer.CreateClient();
var clientFormSender = new ClientFormSender(httpClient);
await clientFormSender.Send(
route: "/SendMessage",
message: "{\"Property\": \"Value\"}",
typeName: "TheMessageType",
typeNamespace: "TheMessageNamespace",
destination: "TheDestination",
attachments: new()
{
{"fileName", "fileContents"u8.ToArray()}
});
#endregion
}
}