forked from Dartanlla/OWS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathResponseBenchmarks.cs
49 lines (42 loc) · 1.64 KB
/
ResponseBenchmarks.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using BenchmarkDotNet.Attributes;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.Logging;
using OWSPublicAPI;
using System.Net.Http;
using System.Threading.Tasks;
namespace OWSBenchmarks
{
[InProcess]
[MemoryDiagnoser]
public class ResponseBenchmarks
{
private HttpClient client;
private StringContent postContent;
//GetUserSession userSession;
//StringContent userSessionStringContent;
[GlobalSetup]
public void GlobalSetup()
{
var factory = new WebApplicationFactory<Startup>()
.WithWebHostBuilder(configuration =>
{
configuration.ConfigureLogging((hostingContext, logging) =>
{
logging.ClearProviders();
});
});
client = factory.CreateClient();
//client.DefaultRequestHeaders.Add("Content-Type", "application/json");
client.DefaultRequestHeaders.Add("X-CustomerGUID", "EEE65F97-BAB1-482E-8439-9A14AE7366B5");
//client.DefaultRequestHeaders.Add("User-Agent", "Fiddler");
postContent = new StringContent("");
}
[Benchmark]
public Task GetUserSessionTime()
{
return client.GetAsync("https://localhost:44303/api/Users/GetUserSession?UserSessionGUID=147DBA25-5689-42A4-A52D-8621F17BB99D");
//return client.PostAsync("http://localhost:52611/RPGUser/GetUserSession/147DBA25-5689-42A4-A52D-8621F17BB99D?CustomerGUID=EEE65F97-BAB1-482E-8439-9A14AE7366B5", postContent);
}
}
}