generated from dotnet/new-repo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestData.cs
74 lines (70 loc) · 2.69 KB
/
TestData.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace UriHelperBenchmarks
{
public static class TestData
{
private static readonly string[] hosts = new[] { "cname.domain.tld" };
private static readonly string[] basePaths = new[] { "", "/base-path", };
private static readonly string[] paths = new[] { "", "/path/one/two/three", };
private static readonly string[] queries = new[] { "", "?param1=value1¶m2=value2¶m3=value3", };
private static readonly string[] fragments = new[] { "", "#fragment", };
public static IEnumerable<object[]> HostPathBasePathQuery()
{
foreach (var host in hosts)
{
foreach (var basePath in basePaths)
{
foreach (var path in paths)
{
foreach (var query in queries)
{
yield return new object[] { new HostString(host), new PathString(basePath), new PathString(path), new QueryString(query), };
}
}
}
}
}
public static IEnumerable<object[]> HostPathBasePathQueryFragment()
{
foreach (var host in hosts)
{
foreach (var basePath in basePaths)
{
foreach (var path in paths)
{
foreach (var query in queries)
{
foreach (var fragment in fragments)
{
yield return new object[] { new HostString(host), new PathString(basePath), new PathString(path), new QueryString(query), new FragmentString(fragment), };
}
}
}
}
}
}
public static IEnumerable<object[]> PathBasePathQueryFragment()
{
foreach (var basePath in basePaths)
{
foreach (var path in paths)
{
foreach (var query in queries)
{
foreach (var fragment in fragments)
{
yield return new object[] { new PathString(basePath), new PathString(path), new QueryString(query), new FragmentString(fragment), };
}
}
}
}
}
}
}