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((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((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((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((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((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((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((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((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((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((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((int)response.StatusCode, 400); } } }