Roles #21

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

View File

@@ -9,7 +9,7 @@ namespace BasicDotnetTemplate.MainProject.Tests;
[TestClass] [TestClass]
public class UserService_Tests public class UserService_Tests
{ {
private static User? _user; private static User _user = ModelsInit.CreateUser();
private static Role? _role; private static Role? _role;
[TestMethod] [TestMethod]
@@ -114,30 +114,31 @@ public class UserService_Tests
// } // }
// } // }
// [TestMethod] [TestMethod]
// public async Task CheckIfEmailIsValid_EmailNotExists() public async Task CheckIfEmailIsValid_EmailNotExists()
// { {
// try try
// { {
// if (_userService != null) var userService = TestUtils.CreateUserService();
// { if (userService != null)
// var valid = await _userService.CheckIfEmailIsValid(_expectedUser?.Email ?? String.Empty); {
// Assert.IsTrue(valid); var valid = await userService.CheckIfEmailIsValid(_user.Email ?? String.Empty);
// } Assert.IsTrue(valid);
// else }
// { else
// Assert.Fail($"UserService is null"); {
// } Assert.Fail($"UserService is null");
// } }
// catch (Exception ex) }
// { catch (Exception ex)
// Console.WriteLine(ex.InnerException); {
// Assert.Fail($"An exception was thrown: {ex}"); Console.WriteLine(ex.InnerException);
// } Assert.Fail($"An exception was thrown: {ex}");
// } }
}
[TestMethod] [TestMethod]
public async Task CreateUserData() public async Task CreateUserAsync_Success()
{ {
try try
{ {
@@ -176,27 +177,28 @@ public class UserService_Tests
} }
} }
// [TestMethod] [TestMethod]
// public async Task CheckIfEmailIsValid_EmailCurrentUser() public async Task CheckIfEmailIsValid_EmailCurrentUser()
// { {
// try try
// { {
// if (_userService != null) var userService = TestUtils.CreateUserService();
// { if (userService != null)
// var valid = await _userService.CheckIfEmailIsValid(_expectedUser?.Email ?? String.Empty, _user?.Guid ?? String.Empty); {
// Assert.IsTrue(valid); var valid = await userService.CheckIfEmailIsValid(_user.Email ?? String.Empty, _user.Guid ?? String.Empty);
// } Assert.IsTrue(valid);
// else }
// { else
// Assert.Fail($"UserService is null"); {
// } Assert.Fail($"UserService is null");
// } }
// catch (Exception ex) }
// { catch (Exception ex)
// Console.WriteLine(ex.InnerException); {
// Assert.Fail($"An exception was thrown: {ex}"); Console.WriteLine(ex.InnerException);
// } Assert.Fail($"An exception was thrown: {ex}");
// } }
}
// [TestMethod] // [TestMethod]
// public async Task CheckIfEmailIsValid_EmailAlreadyExists() // public async Task CheckIfEmailIsValid_EmailAlreadyExists()