formated all files
This commit is contained in:
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
// Use IntelliSense to find out which attributes exist for C# debugging
|
||||
// Use hover for the description of the existing attributes
|
||||
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md
|
||||
"name": ".NET Core Launch (console)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
// If you have changed target frameworks, make sure to update the program path.
|
||||
"program": "${workspaceFolder}/bin/Debug/net8.0/backendCs.Test.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
|
||||
"console": "internalConsole",
|
||||
"stopAtEntry": false
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach"
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"build",
|
||||
"${workspaceFolder}/backendCs.Test.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary;ForceNoAlign"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "publish",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"publish",
|
||||
"${workspaceFolder}/backendCs.Test.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary;ForceNoAlign"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "watch",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"watch",
|
||||
"run",
|
||||
"--project",
|
||||
"${workspaceFolder}/backendCs.Test.csproj"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
namespace backendCs.Test;
|
||||
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
|
||||
[TestClass]
|
||||
public class UnitTest1
|
||||
{
|
||||
[TestMethod]
|
||||
async public Task TestMethodReset()
|
||||
public async Task TestMethodReset()
|
||||
{
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
@@ -16,122 +18,193 @@ public class UnitTest1
|
||||
Assert.AreEqual<Int32>((int)response.StatusCode, 200);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
async public Task TestMethodGetall1()
|
||||
public async 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");
|
||||
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()
|
||||
public async 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=");
|
||||
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()
|
||||
|
||||
[TestMethod]
|
||||
public async 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");
|
||||
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()
|
||||
public async 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");
|
||||
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()
|
||||
public async 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");
|
||||
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()
|
||||
public async 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");
|
||||
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()
|
||||
public async 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");
|
||||
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()
|
||||
public async 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");
|
||||
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()
|
||||
public async 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");
|
||||
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()
|
||||
|
||||
[TestMethod]
|
||||
public async Task TestMethodGetuser2()
|
||||
{
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
// Make a GET request to a URL
|
||||
HttpResponseMessage response = await client.GetAsync("http://localhost:5000/api/getuser");
|
||||
HttpResponseMessage response = await client.GetAsync(
|
||||
"http://localhost:5000/api/getuser"
|
||||
);
|
||||
|
||||
// Ensure we have a successful response
|
||||
Assert.AreEqual<Int32>((int)response.StatusCode, 400);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task TestMethodRegister1()
|
||||
{
|
||||
using (HttpClient client = new())
|
||||
{
|
||||
// Make a GET request to a URL
|
||||
var jsonData =
|
||||
"{ \"f_name\": \"donna\", \"l_name\": \"cow\", \"mail\": \"tombo@mail.com\", \"password\": \"1234567890\" }";
|
||||
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
|
||||
|
||||
HttpResponseMessage response = await client.PostAsync(
|
||||
"http://localhost:5000/api/register",
|
||||
content
|
||||
);
|
||||
|
||||
// Ensure we have a successful response
|
||||
Assert.AreEqual<Int32>((int)response.StatusCode, 200);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task TestMethodLogin()
|
||||
{
|
||||
using (HttpClient client = new())
|
||||
{
|
||||
// Make a GET request to a URL
|
||||
var jsonData = "{ \"mail\": \"tombo@mail.com\", \"password\": \"1234567890\" }";
|
||||
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
|
||||
|
||||
HttpResponseMessage response = await client.PostAsync(
|
||||
"http://localhost:5000/api/login",
|
||||
content
|
||||
);
|
||||
|
||||
// Ensure we have a successful response
|
||||
Assert.AreEqual<Int32>((int)response.StatusCode, 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -13,7 +13,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("backendCs.Test")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8e4317abde8c48644e2bc317481f0f846c577d4b")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+cb7b3ad94c91aad561fa90871a3e078e741f566c")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("backendCs.Test")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("backendCs.Test")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
a3618e90ec8e0b41c39e691b17b268fc26531e93f58c71336bc37fefe3594fc9
|
||||
d5818043832e259ded45b9771c78c909a325898a23799ca0c691beda0cd33197
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user