-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMweWithoutAspNetTest.cs
33 lines (30 loc) · 1.08 KB
/
MweWithoutAspNetTest.cs
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
using EDILibrary;
using Xunit;
namespace AhbichtClient.IntegrationTest;
/// <summary>
/// A minimal working example on how to use this library without ASP.NET
/// </summary>
public class MweWithoutAspNetTest
{
/// <summary>
/// in asp.net applications, there's a service collection that is used to create the http client factory for you
/// </summary>
internal class MyHttpClientFactory : IHttpClientFactory
{
public HttpClient CreateClient(string name)
{
return new HttpClient
{
BaseAddress = new Uri("http://localhost:7071") // or use "http://ahbicht.azurewebsites.net
};
}
}
[Fact]
public async Task Test_Ahbicht_Communication()
{
IHttpClientFactory myFactory = new MyHttpClientFactory();
IAhbichtAuthenticator myAuthenticator = new NoAuthenticator(); // or use ClientIdClientSecretAuthenticator
var client = new AhbichtRestClient(myFactory, myAuthenticator);
await client.ResolvePackage("10P", EdifactFormat.UTILMD, EdifactFormatVersion.FV2404);
}
}