added tests for backend, router dom to frontend

This commit is contained in:
QkoSad
2024-12-03 16:09:25 +02:00
parent 8e4317abde
commit cb7b3ad94c
1142 changed files with 3599 additions and 573520 deletions
+137
View File
@@ -0,0 +1,137 @@
namespace backendCs.Test;
using System.Net.Http;
[TestClass]
public class UnitTest1
{
[TestMethod]
async public Task TestMethodReset()
{
using (HttpClient client = new HttpClient())
{
// Make a GET request to a URL
HttpResponseMessage response = await client.GetAsync("http://localhost:5000/api/reset");
// Ensure we have a successful response
Assert.AreEqual<Int32>((int)response.StatusCode, 200);
}
}
[TestMethod]
async public Task TestMethodGetall1()
{
using (HttpClient client = new HttpClient())
{
// Make a GET request to a URL
HttpResponseMessage response = await client.GetAsync("http://localhost:5000/api/getall?offset=10");
// Ensure we have a successful response
Assert.AreEqual<Int32>((int)response.StatusCode, 200);
}
}
[TestMethod]
async public Task TestMethodGetall2()
{
using (HttpClient client = new HttpClient())
{
// Make a GET request to a URL
HttpResponseMessage response = await client.GetAsync("http://localhost:5000/api/getall?offset=");
// Ensure we have a successful response
Assert.AreEqual<Int32>((int)response.StatusCode, 400);
}
}
async public Task TestMethodGetall3()
{
using (HttpClient client = new HttpClient())
{
// Make a GET request to a URL
HttpResponseMessage response = await client.GetAsync("http://localhost:5000/api/getall?offset=10&from=2020-01-01&to=2024-01-01&orderby=time&order=true");
// Ensure we have a successful response
Assert.AreEqual<Int32>((int)response.StatusCode, 200);
}
}
[TestMethod]
async public Task TestMethodGettopten1()
{
using (HttpClient client = new HttpClient())
{
// Make a GET request to a URL
HttpResponseMessage response = await client.GetAsync("http://localhost:5000/api/gettopten?from=2000-01-01&to=2024-01-01&filterby=project");
// Ensure we have a successful response
Assert.AreEqual<Int32>((int)response.StatusCode, 200);
}
}
[TestMethod]
async public Task TestMethodGettopten2()
{
using (HttpClient client = new HttpClient())
{
// Make a GET request to a URL
HttpResponseMessage response = await client.GetAsync("http://localhost:5000/api/gettopten?from=2000-01-01&to=2024-01-01&filterby=user");
// Ensure we have a successful response
Assert.AreEqual<Int32>((int)response.StatusCode, 200);
}
}
[TestMethod]
async public Task TestMethodGettopten3()
{
using (HttpClient client = new HttpClient())
{
// Make a GET request to a URL
HttpResponseMessage response = await client.GetAsync("http://localhost:5000/api/gettopten?to=2024-01-01&filterby=project");
// Ensure we have a successful response
Assert.AreEqual<Int32>((int)response.StatusCode, 400);
}
}
[TestMethod]
async public Task TestMethodGettopten4()
{
using (HttpClient client = new HttpClient())
{
// Make a GET request to a URL
HttpResponseMessage response = await client.GetAsync("http://localhost:5000/api/gettopten?from=2000-01-01&filterby=project");
// Ensure we have a successful response
Assert.AreEqual<Int32>((int)response.StatusCode, 400);
}
}
[TestMethod]
async public Task TestMethodGettopten5()
{
using (HttpClient client = new HttpClient())
{
// Make a GET request to a URL
HttpResponseMessage response = await client.GetAsync("http://localhost:5000/api/gettopten?from=2000-01-01&to=2024-01-01");
// Ensure we have a successful response
Assert.AreEqual<Int32>((int)response.StatusCode, 400);
}
}
[TestMethod]
async public Task TestMethodGetuser1()
{
using (HttpClient client = new HttpClient())
{
// Make a GET request to a URL
HttpResponseMessage response = await client.GetAsync("http://localhost:5000/api/getuser?userid=1");
// Ensure we have a successful response
Assert.AreEqual<Int32>((int)response.StatusCode, 200);
}
}
async public Task TestMethodGetuser2()
{
using (HttpClient client = new HttpClient())
{
// Make a GET request to a URL
HttpResponseMessage response = await client.GetAsync("http://localhost:5000/api/getuser");
// Ensure we have a successful response
Assert.AreEqual<Int32>((int)response.StatusCode, 400);
}
}
}