Adding role creation during startup + minor fixes in tests

This commit is contained in:
2025-03-16 22:41:44 +01:00
parent 7f5178883d
commit 18e713153b
48 changed files with 1449 additions and 340 deletions

View File

@@ -7,6 +7,7 @@ using BasicDotnetTemplate.MainProject;
using BasicDotnetTemplate.MainProject.Models.Api.Response;
using Microsoft.Extensions.DependencyModel.Resolution;
using BasicDotnetTemplate.MainProject.Models.Settings;
using Microsoft.AspNetCore.Http;
namespace BasicDotnetTemplate.MainProject.Tests;
@@ -43,7 +44,7 @@ public class Settings_Tests
catch (Exception ex)
{
Console.WriteLine(ex.InnerException);
Assert.Fail($"An exception was thrown: {ex.Message}");
Assert.Fail($"An exception was thrown: {ex}");
}
}
@@ -53,12 +54,12 @@ public class Settings_Tests
try
{
var baseResponse = new BaseResponse<object>(201, null, null);
Assert.IsFalse(baseResponse.Status == 200);
Assert.IsFalse(baseResponse.Status == StatusCodes.Status200OK);
}
catch (Exception ex)
{
Console.WriteLine(ex.InnerException);
Assert.Fail($"An exception was thrown: {ex.Message}");
Assert.Fail($"An exception was thrown: {ex}");
}
}
@@ -68,12 +69,12 @@ public class Settings_Tests
try
{
var baseResponse = new BaseResponse<object>(200, "This is a test message", null);
Assert.IsTrue(baseResponse.Status == 200 && baseResponse.Message == "This is a test message" && baseResponse.Data == null);
Assert.IsTrue(baseResponse.Status == StatusCodes.Status200OK && baseResponse.Message == "This is a test message" && baseResponse.Data == null);
}
catch (Exception ex)
{
Console.WriteLine(ex.InnerException);
Assert.Fail($"An exception was thrown: {ex.Message}");
Assert.Fail($"An exception was thrown: {ex}");
}
}
@@ -84,12 +85,12 @@ public class Settings_Tests
{
string[] data = { "Volvo", "BMW", "Ford", "Mazda" };
var baseResponse = new BaseResponse<string[]>(200, "This is a test message", data);
Assert.IsTrue(baseResponse.Status == 200 && baseResponse.Message == "This is a test message" && baseResponse.Data == data);
Assert.IsTrue(baseResponse.Status == StatusCodes.Status200OK && baseResponse.Message == "This is a test message" && baseResponse.Data == data);
}
catch (Exception ex)
{
Console.WriteLine(ex.InnerException);
Assert.Fail($"An exception was thrown: {ex.Message}");
Assert.Fail($"An exception was thrown: {ex}");
}
}
}