add query arg test
This commit is contained in:
parent
6d74d659f6
commit
e1e1596e54
|
|
@ -77,6 +77,19 @@ public class SimpleServerTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task CheckQueryArgs() {
|
||||||
|
foreach (var a1 in "test1;longstring2;something else with a space".Split(';')) {
|
||||||
|
foreach (var a2 in new[] { -10, 2, -2, 5, 0, 4 }) {
|
||||||
|
foreach (var a3 in new[] { -1, 9, 2, -20, 0 }) {
|
||||||
|
var resp = await AssertGetStatusCodeAsync($"returnqueries?arg1={a1}&arg2={a2}&arg3={a3}", HttpStatusCode.OK);
|
||||||
|
var str = await resp.Content.ReadAsStringAsync();
|
||||||
|
Assert.AreEqual(TestEndpoints.GetReturnQueryPageResult(a1, a2, a3), str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class TestEndpoints {
|
public class TestEndpoints {
|
||||||
[HttpEndpoint(HttpRequestType.GET, "/", "index.html")]
|
[HttpEndpoint(HttpRequestType.GET, "/", "index.html")]
|
||||||
public static async Task Index(RequestContext req) {
|
public static async Task Index(RequestContext req) {
|
||||||
|
|
@ -101,5 +114,13 @@ public class SimpleServerTest {
|
||||||
public static async Task TestPage3(RequestContext req) {
|
public static async Task TestPage3(RequestContext req) {
|
||||||
await req.RespWriter.WriteAsync(GetHttpPageContentFromPrefix("testpage3"));
|
await req.RespWriter.WriteAsync(GetHttpPageContentFromPrefix("testpage3"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static string GetReturnQueryPageResult(string arg1, int arg2, int arg3) => $"{arg1};{arg2 * 2 - arg3 * 5}";
|
||||||
|
|
||||||
|
[HttpEndpoint(HttpRequestType.GET, "/returnqueries")]
|
||||||
|
public static async Task TestPage3(RequestContext req, string arg1, int arg2, int arg3) {
|
||||||
|
await req.RespWriter.WriteAsync(GetReturnQueryPageResult(arg1, arg2, arg3));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user