Roles #21

Merged
csimonapastore merged 36 commits from roles into main 2025-03-26 23:52:19 +01:00
Showing only changes of commit aefaefd64f - Show all commits

View File

@@ -9,13 +9,8 @@ namespace BasicDotnetTemplate.MainProject.Tests;
[TestClass] [TestClass]
public class UserService_Tests public class UserService_Tests
{ {
private static Role? _expectedRole;
private static User? _user; private static User? _user;
private static Role? _role; private static Role? _role;
private static User? _expectedUser;
private static RoleService? _roleService;
private static UserService? _userService;
[TestMethod] [TestMethod]
public void Inizialize() public void Inizialize()
@@ -23,14 +18,14 @@ public class UserService_Tests
try try
{ {
var userService = TestUtils.CreateUserService(); var userService = TestUtils.CreateUserService();
if(userService != null) if (userService != null)
{ {
Assert.IsInstanceOfType(userService, typeof(UserService)); Assert.IsInstanceOfType(userService, typeof(UserService));
} }
else else
{ {
Assert.Fail($"UserService is null"); Assert.Fail($"UserService is null");
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -74,14 +69,11 @@ public class UserService_Tests
{ {
try try
{ {
_expectedUser = ModelsInit.CreateUser(); var userService = TestUtils.CreateUserService();
_userService = TestUtils.CreateUserService();
_roleService = TestUtils.CreateRoleService();
var testString = "test"; var testString = "test";
if (_userService != null) if (userService != null)
{ {
var user = await _userService.GetUserByUsernameAndPassword(testString, testString); var user = await userService.GetUserByUsernameAndPassword(testString, testString);
Assert.IsTrue(user == null); Assert.IsTrue(user == null);
} }
else else