Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c4ef564d71 | |||
| 9e95ad1cc8 | |||
| 4c3aa30cbb | |||
|
|
54a5106314 |
@@ -30,7 +30,7 @@ public class RootController_Test
|
|||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
var data = (OkResult)result;
|
var data = (OkResult)result;
|
||||||
Assert.IsTrue(data.StatusCode == StatusCodes.Status200OK);
|
Assert.AreEqual(StatusCodes.Status200OK, data.StatusCode);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -40,10 +40,10 @@ public class AutoMapperConfiguration_Tests
|
|||||||
DatabaseSqlServer.User user = ModelsInit.CreateUser();
|
DatabaseSqlServer.User user = ModelsInit.CreateUser();
|
||||||
UserDto? data = _mapper?.Map<UserDto>(user);
|
UserDto? data = _mapper?.Map<UserDto>(user);
|
||||||
|
|
||||||
Assert.IsTrue(data?.Guid == user.Guid);
|
Assert.AreEqual(user.Guid, data?.Guid);
|
||||||
Assert.IsTrue(data?.FirstName == user.FirstName);
|
Assert.AreEqual(user.FirstName, data?.FirstName);
|
||||||
Assert.IsTrue(data?.LastName == user.LastName);
|
Assert.AreEqual(user.LastName, data?.LastName);
|
||||||
Assert.IsTrue(data?.Email == user.Email);
|
Assert.AreEqual(user.Email, data?.Email);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class ApiResponse_Tests
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var baseResponse = new BaseResponse<object>(201, null, null);
|
var baseResponse = new BaseResponse<object>(201, null, null);
|
||||||
Assert.IsFalse(baseResponse.Status == StatusCodes.Status200OK);
|
Assert.AreNotEqual(StatusCodes.Status200OK, baseResponse.Status);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class AuthenticateResponse_Tests
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var authenticateResponse = new AuthenticateResponse(201, null, null);
|
var authenticateResponse = new AuthenticateResponse(201, null, null);
|
||||||
Assert.IsFalse(authenticateResponse.Status == StatusCodes.Status200OK);
|
Assert.AreNotEqual(StatusCodes.Status200OK, authenticateResponse.Status);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class GetRoleResponse_Tests
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var getRoleResponse = new GetRoleResponse(201, null, null);
|
var getRoleResponse = new GetRoleResponse(201, null, null);
|
||||||
Assert.IsFalse(getRoleResponse.Status == StatusCodes.Status200OK);
|
Assert.AreNotEqual(StatusCodes.Status200OK, getRoleResponse.Status);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class GetUserResponse_Tests
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var getUserResponse = new GetUserResponse(201, null, null);
|
var getUserResponse = new GetUserResponse(201, null, null);
|
||||||
Assert.IsFalse(getUserResponse.Status == StatusCodes.Status200OK);
|
Assert.AreNotEqual(StatusCodes.Status200OK, getUserResponse.Status);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class Settings_Tests
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var baseResponse = new BaseResponse<object>(201, null, null);
|
var baseResponse = new BaseResponse<object>(201, null, null);
|
||||||
Assert.IsFalse(baseResponse.Status == StatusCodes.Status200OK);
|
Assert.AreNotEqual(StatusCodes.Status200OK, baseResponse.Status);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class AuthService_Tests
|
|||||||
if (authService != null)
|
if (authService != null)
|
||||||
{
|
{
|
||||||
var authenticatedUser = await authService.AuthenticateAsync(request.Data);
|
var authenticatedUser = await authService.AuthenticateAsync(request.Data);
|
||||||
Assert.IsTrue(authenticatedUser == null);
|
Assert.IsNull(authenticatedUser);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -93,7 +93,7 @@ public class AuthService_Tests
|
|||||||
if (authService != null)
|
if (authService != null)
|
||||||
{
|
{
|
||||||
var authenticatedUser = await authService.AuthenticateAsync(request.Data);
|
var authenticatedUser = await authService.AuthenticateAsync(request.Data);
|
||||||
Assert.IsTrue(authenticatedUser == null);
|
Assert.IsNull(authenticatedUser);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class JwtService_Tests
|
|||||||
if (jwtService != null)
|
if (jwtService != null)
|
||||||
{
|
{
|
||||||
var jwt = jwtService.GenerateToken(testString);
|
var jwt = jwtService.GenerateToken(testString);
|
||||||
Assert.IsTrue(jwt != null);
|
Assert.IsNotNull(jwt);
|
||||||
Assert.IsInstanceOfType(jwt, typeof(string));
|
Assert.IsInstanceOfType(jwt, typeof(string));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public class PermissionService_Tests
|
|||||||
if (_permissionService != null)
|
if (_permissionService != null)
|
||||||
{
|
{
|
||||||
var permission = await _permissionService.GetPermissionSystemByGuidAsync(Guid.NewGuid().ToString());
|
var permission = await _permissionService.GetPermissionSystemByGuidAsync(Guid.NewGuid().ToString());
|
||||||
Assert.IsTrue(permission == null);
|
Assert.IsNull(permission);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -117,7 +117,7 @@ public class PermissionService_Tests
|
|||||||
if (_permissionService != null)
|
if (_permissionService != null)
|
||||||
{
|
{
|
||||||
var permission = await _permissionService.GetPermissionSystemByNameAsync(Guid.NewGuid().ToString());
|
var permission = await _permissionService.GetPermissionSystemByNameAsync(Guid.NewGuid().ToString());
|
||||||
Assert.IsTrue(permission == null);
|
Assert.IsNull(permission);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -139,7 +139,7 @@ public class PermissionService_Tests
|
|||||||
var permission = await _permissionService.CreatePermissionSystemAsync(_permissionSystem.Name, true);
|
var permission = await _permissionService.CreatePermissionSystemAsync(_permissionSystem.Name, true);
|
||||||
Assert.IsInstanceOfType(permission, typeof(PermissionSystem));
|
Assert.IsInstanceOfType(permission, typeof(PermissionSystem));
|
||||||
Assert.IsNotNull(permission);
|
Assert.IsNotNull(permission);
|
||||||
Assert.IsTrue(permission.Name == _permissionSystem.Name);
|
Assert.AreEqual(_permissionSystem.Name, permission.Name);
|
||||||
Assert.IsTrue(permission.Enabled);
|
Assert.IsTrue(permission.Enabled);
|
||||||
_permissionSystem = permission;
|
_permissionSystem = permission;
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ public class PermissionService_Tests
|
|||||||
{
|
{
|
||||||
var updated = await _permissionService.HandleEnabledPermissionSystemAsync(_permissionSystem, false);
|
var updated = await _permissionService.HandleEnabledPermissionSystemAsync(_permissionSystem, false);
|
||||||
Assert.IsTrue(updated);
|
Assert.IsTrue(updated);
|
||||||
Assert.IsTrue(!_permissionSystem.Enabled);
|
Assert.IsFalse(_permissionSystem.Enabled);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -210,8 +210,8 @@ public class PermissionService_Tests
|
|||||||
var permission = await _permissionService.GetPermissionSystemByGuidAsync(_permissionSystem.Guid);
|
var permission = await _permissionService.GetPermissionSystemByGuidAsync(_permissionSystem.Guid);
|
||||||
Assert.IsNotNull(permission);
|
Assert.IsNotNull(permission);
|
||||||
Assert.IsInstanceOfType(permission, typeof(PermissionSystem));
|
Assert.IsInstanceOfType(permission, typeof(PermissionSystem));
|
||||||
Assert.IsTrue(permission.Name == _permissionSystem.Name);
|
Assert.AreEqual(_permissionSystem.Name, permission.Name);
|
||||||
Assert.IsTrue(permission.Enabled == _permissionSystem.Enabled);
|
Assert.AreEqual( _permissionSystem.Enabled, permission.Enabled);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -236,8 +236,8 @@ public class PermissionService_Tests
|
|||||||
var permission = await _permissionService.GetPermissionSystemByNameAsync(_permissionSystem.Name);
|
var permission = await _permissionService.GetPermissionSystemByNameAsync(_permissionSystem.Name);
|
||||||
Assert.IsNotNull(permission);
|
Assert.IsNotNull(permission);
|
||||||
Assert.IsInstanceOfType(permission, typeof(PermissionSystem));
|
Assert.IsInstanceOfType(permission, typeof(PermissionSystem));
|
||||||
Assert.IsTrue(permission.Guid == _permissionSystem.Guid);
|
Assert.AreEqual(_permissionSystem.Guid, permission.Guid);
|
||||||
Assert.IsTrue(permission.Enabled == _permissionSystem.Enabled);
|
Assert.AreEqual( _permissionSystem.Enabled, permission.Enabled);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -265,7 +265,7 @@ public class PermissionService_Tests
|
|||||||
if (_permissionService != null)
|
if (_permissionService != null)
|
||||||
{
|
{
|
||||||
var permission = await _permissionService.GetPermissionModuleByGuidAsync(Guid.NewGuid().ToString());
|
var permission = await _permissionService.GetPermissionModuleByGuidAsync(Guid.NewGuid().ToString());
|
||||||
Assert.IsTrue(permission == null);
|
Assert.IsNull(permission);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -288,7 +288,7 @@ public class PermissionService_Tests
|
|||||||
if (_permissionService != null)
|
if (_permissionService != null)
|
||||||
{
|
{
|
||||||
var permission = await _permissionService.GetPermissionModuleByNameAsync(Guid.NewGuid().ToString());
|
var permission = await _permissionService.GetPermissionModuleByNameAsync(Guid.NewGuid().ToString());
|
||||||
Assert.IsTrue(permission == null);
|
Assert.IsNull(permission);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -310,7 +310,7 @@ public class PermissionService_Tests
|
|||||||
var permission = await _permissionService.CreatePermissionModuleAsync(_permissionModule.Name, true);
|
var permission = await _permissionService.CreatePermissionModuleAsync(_permissionModule.Name, true);
|
||||||
Assert.IsInstanceOfType(permission, typeof(PermissionModule));
|
Assert.IsInstanceOfType(permission, typeof(PermissionModule));
|
||||||
Assert.IsNotNull(permission);
|
Assert.IsNotNull(permission);
|
||||||
Assert.IsTrue(permission.Name == _permissionModule.Name);
|
Assert.AreEqual(_permissionModule.Name, permission.Name);
|
||||||
Assert.IsTrue(permission.Enabled);
|
Assert.IsTrue(permission.Enabled);
|
||||||
_permissionModule = permission;
|
_permissionModule = permission;
|
||||||
|
|
||||||
@@ -362,7 +362,7 @@ public class PermissionService_Tests
|
|||||||
{
|
{
|
||||||
var updated = await _permissionService.HandleEnabledPermissionModuleAsync(_permissionModule, false);
|
var updated = await _permissionService.HandleEnabledPermissionModuleAsync(_permissionModule, false);
|
||||||
Assert.IsTrue(updated);
|
Assert.IsTrue(updated);
|
||||||
Assert.IsTrue(!_permissionModule.Enabled);
|
Assert.IsFalse(_permissionModule.Enabled);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -383,8 +383,8 @@ public class PermissionService_Tests
|
|||||||
var permission = await _permissionService.GetPermissionModuleByGuidAsync(_permissionModule.Guid);
|
var permission = await _permissionService.GetPermissionModuleByGuidAsync(_permissionModule.Guid);
|
||||||
Assert.IsNotNull(permission);
|
Assert.IsNotNull(permission);
|
||||||
Assert.IsInstanceOfType(permission, typeof(PermissionModule));
|
Assert.IsInstanceOfType(permission, typeof(PermissionModule));
|
||||||
Assert.IsTrue(permission.Name == _permissionModule.Name);
|
Assert.AreEqual(_permissionModule.Name, permission.Name);
|
||||||
Assert.IsTrue(permission.Enabled == _permissionModule.Enabled);
|
Assert.AreEqual( _permissionModule.Enabled, permission.Enabled);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -409,8 +409,8 @@ public class PermissionService_Tests
|
|||||||
var permission = await _permissionService.GetPermissionModuleByNameAsync(_permissionModule.Name);
|
var permission = await _permissionService.GetPermissionModuleByNameAsync(_permissionModule.Name);
|
||||||
Assert.IsNotNull(permission);
|
Assert.IsNotNull(permission);
|
||||||
Assert.IsInstanceOfType(permission, typeof(PermissionModule));
|
Assert.IsInstanceOfType(permission, typeof(PermissionModule));
|
||||||
Assert.IsTrue(permission.Guid == _permissionModule.Guid);
|
Assert.AreEqual(_permissionModule.Guid, permission.Guid);
|
||||||
Assert.IsTrue(permission.Enabled == _permissionModule.Enabled);
|
Assert.AreEqual( _permissionModule.Enabled, permission.Enabled);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -438,7 +438,7 @@ public class PermissionService_Tests
|
|||||||
if (_permissionService != null)
|
if (_permissionService != null)
|
||||||
{
|
{
|
||||||
var permission = await _permissionService.GetPermissionOperationByGuidAsync(Guid.NewGuid().ToString());
|
var permission = await _permissionService.GetPermissionOperationByGuidAsync(Guid.NewGuid().ToString());
|
||||||
Assert.IsTrue(permission == null);
|
Assert.IsNull(permission);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -461,7 +461,7 @@ public class PermissionService_Tests
|
|||||||
if (_permissionService != null)
|
if (_permissionService != null)
|
||||||
{
|
{
|
||||||
var permission = await _permissionService.GetPermissionOperationByNameAsync(Guid.NewGuid().ToString());
|
var permission = await _permissionService.GetPermissionOperationByNameAsync(Guid.NewGuid().ToString());
|
||||||
Assert.IsTrue(permission == null);
|
Assert.IsNull(permission);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -483,7 +483,7 @@ public class PermissionService_Tests
|
|||||||
var permission = await _permissionService.CreatePermissionOperationAsync(_permissionOperation.Name);
|
var permission = await _permissionService.CreatePermissionOperationAsync(_permissionOperation.Name);
|
||||||
Assert.IsInstanceOfType(permission, typeof(PermissionOperation));
|
Assert.IsInstanceOfType(permission, typeof(PermissionOperation));
|
||||||
Assert.IsNotNull(permission);
|
Assert.IsNotNull(permission);
|
||||||
Assert.IsTrue(permission.Name == _permissionOperation.Name);
|
Assert.AreEqual(_permissionOperation.Name, permission.Name);
|
||||||
_permissionOperation = permission;
|
_permissionOperation = permission;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -536,7 +536,7 @@ public class PermissionService_Tests
|
|||||||
var permission = await _permissionService.GetPermissionOperationByGuidAsync(_permissionOperation.Guid);
|
var permission = await _permissionService.GetPermissionOperationByGuidAsync(_permissionOperation.Guid);
|
||||||
Assert.IsNotNull(permission);
|
Assert.IsNotNull(permission);
|
||||||
Assert.IsInstanceOfType(permission, typeof(PermissionOperation));
|
Assert.IsInstanceOfType(permission, typeof(PermissionOperation));
|
||||||
Assert.IsTrue(permission.Name == _permissionOperation.Name);
|
Assert.AreEqual(_permissionOperation.Name, permission.Name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -561,7 +561,7 @@ public class PermissionService_Tests
|
|||||||
var permission = await _permissionService.GetPermissionOperationByNameAsync(_permissionOperation.Name);
|
var permission = await _permissionService.GetPermissionOperationByNameAsync(_permissionOperation.Name);
|
||||||
Assert.IsNotNull(permission);
|
Assert.IsNotNull(permission);
|
||||||
Assert.IsInstanceOfType(permission, typeof(PermissionOperation));
|
Assert.IsInstanceOfType(permission, typeof(PermissionOperation));
|
||||||
Assert.IsTrue(permission.Guid == _permissionOperation.Guid);
|
Assert.AreEqual(_permissionOperation.Guid, permission.Guid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -589,7 +589,7 @@ public class PermissionService_Tests
|
|||||||
if (_permissionService != null)
|
if (_permissionService != null)
|
||||||
{
|
{
|
||||||
var permission = await _permissionService.GetPermissionSystemModuleByGuidAsync(Guid.NewGuid().ToString());
|
var permission = await _permissionService.GetPermissionSystemModuleByGuidAsync(Guid.NewGuid().ToString());
|
||||||
Assert.IsTrue(permission == null);
|
Assert.IsNull(permission);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -660,7 +660,7 @@ public class PermissionService_Tests
|
|||||||
{
|
{
|
||||||
var updated = await _permissionService.HandleEnabledPermissionSystemModuleAsync(_permissionSystemModule, false);
|
var updated = await _permissionService.HandleEnabledPermissionSystemModuleAsync(_permissionSystemModule, false);
|
||||||
Assert.IsTrue(updated);
|
Assert.IsTrue(updated);
|
||||||
Assert.IsTrue(!_permissionSystemModule.Enabled);
|
Assert.IsFalse(_permissionSystemModule.Enabled);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -681,7 +681,7 @@ public class PermissionService_Tests
|
|||||||
var permission = await _permissionService.GetPermissionSystemModuleByGuidAsync(_permissionSystemModule.Guid);
|
var permission = await _permissionService.GetPermissionSystemModuleByGuidAsync(_permissionSystemModule.Guid);
|
||||||
Assert.IsNotNull(permission);
|
Assert.IsNotNull(permission);
|
||||||
Assert.IsInstanceOfType(permission, typeof(PermissionSystemModule));
|
Assert.IsInstanceOfType(permission, typeof(PermissionSystemModule));
|
||||||
Assert.IsTrue(permission.Enabled == _permissionSystemModule.Enabled);
|
Assert.AreEqual( _permissionSystemModule.Enabled, permission.Enabled);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -709,7 +709,7 @@ public class PermissionService_Tests
|
|||||||
if (_permissionService != null)
|
if (_permissionService != null)
|
||||||
{
|
{
|
||||||
var permission = await _permissionService.GetPermissionSystemModuleOperationByGuidAsync(Guid.NewGuid().ToString());
|
var permission = await _permissionService.GetPermissionSystemModuleOperationByGuidAsync(Guid.NewGuid().ToString());
|
||||||
Assert.IsTrue(permission == null);
|
Assert.IsNull(permission);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -780,7 +780,7 @@ public class PermissionService_Tests
|
|||||||
{
|
{
|
||||||
var updated = await _permissionService.HandleEnabledPermissionSystemModuleOperationAsync(_permissionSystemModuleOperation, false);
|
var updated = await _permissionService.HandleEnabledPermissionSystemModuleOperationAsync(_permissionSystemModuleOperation, false);
|
||||||
Assert.IsTrue(updated);
|
Assert.IsTrue(updated);
|
||||||
Assert.IsTrue(!_permissionSystemModuleOperation.Enabled);
|
Assert.IsFalse(_permissionSystemModuleOperation.Enabled);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -801,7 +801,7 @@ public class PermissionService_Tests
|
|||||||
var permission = await _permissionService.GetPermissionSystemModuleOperationByGuidAsync(_permissionSystemModuleOperation.Guid);
|
var permission = await _permissionService.GetPermissionSystemModuleOperationByGuidAsync(_permissionSystemModuleOperation.Guid);
|
||||||
Assert.IsNotNull(permission);
|
Assert.IsNotNull(permission);
|
||||||
Assert.IsInstanceOfType(permission, typeof(PermissionSystemModuleOperation));
|
Assert.IsInstanceOfType(permission, typeof(PermissionSystemModuleOperation));
|
||||||
Assert.IsTrue(permission.Enabled == _permissionSystemModuleOperation.Enabled);
|
Assert.AreEqual(_permissionSystemModuleOperation.Enabled, permission.Enabled);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -829,7 +829,7 @@ public class PermissionService_Tests
|
|||||||
if (_permissionService != null)
|
if (_permissionService != null)
|
||||||
{
|
{
|
||||||
var permission = await _permissionService.GetRolePermissionSystemModuleOperationByGuidAsync(Guid.NewGuid().ToString());
|
var permission = await _permissionService.GetRolePermissionSystemModuleOperationByGuidAsync(Guid.NewGuid().ToString());
|
||||||
Assert.IsTrue(permission == null);
|
Assert.IsNull(permission);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -916,7 +916,7 @@ public class PermissionService_Tests
|
|||||||
{
|
{
|
||||||
var updated = await _permissionService.HandleEnabledRolePermissionSystemModuleOperationAsync(_rolePermissionSystemModuleOperation, false);
|
var updated = await _permissionService.HandleEnabledRolePermissionSystemModuleOperationAsync(_rolePermissionSystemModuleOperation, false);
|
||||||
Assert.IsTrue(updated);
|
Assert.IsTrue(updated);
|
||||||
Assert.IsTrue(!_rolePermissionSystemModuleOperation.Active);
|
Assert.IsFalse(_rolePermissionSystemModuleOperation.Active);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -937,7 +937,7 @@ public class PermissionService_Tests
|
|||||||
var permission = await _permissionService.GetRolePermissionSystemModuleOperationByGuidAsync(_rolePermissionSystemModuleOperation.Guid);
|
var permission = await _permissionService.GetRolePermissionSystemModuleOperationByGuidAsync(_rolePermissionSystemModuleOperation.Guid);
|
||||||
Assert.IsNotNull(permission);
|
Assert.IsNotNull(permission);
|
||||||
Assert.IsInstanceOfType(permission, typeof(RolePermissionSystemModuleOperation));
|
Assert.IsInstanceOfType(permission, typeof(RolePermissionSystemModuleOperation));
|
||||||
Assert.IsTrue(permission.Active == _rolePermissionSystemModuleOperation.Active);
|
Assert.AreEqual( _rolePermissionSystemModuleOperation.Active, permission.Active);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1067,7 +1067,7 @@ public class PermissionService_Tests
|
|||||||
if (_permissionService != null)
|
if (_permissionService != null)
|
||||||
{
|
{
|
||||||
List<string> permissions = _permissionService.CreatePermissionsOnStartupAsync();
|
List<string> permissions = _permissionService.CreatePermissionsOnStartupAsync();
|
||||||
Assert.IsFalse(permissions == null);
|
Assert.IsNotNull(permissions);
|
||||||
List<string> cleanedPermissions = new();
|
List<string> cleanedPermissions = new();
|
||||||
|
|
||||||
foreach (var permission in permissions)
|
foreach (var permission in permissions)
|
||||||
|
|||||||
@@ -79,8 +79,8 @@ public class RoleService_Tests
|
|||||||
var role = await _roleService.CreateRoleAsync(data);
|
var role = await _roleService.CreateRoleAsync(data);
|
||||||
Assert.IsInstanceOfType(role, typeof(Role));
|
Assert.IsInstanceOfType(role, typeof(Role));
|
||||||
Assert.IsNotNull(role);
|
Assert.IsNotNull(role);
|
||||||
Assert.IsTrue(_expectedRole?.Name == role.Name);
|
Assert.AreEqual(_expectedRole?.Name, role.Name);
|
||||||
Assert.IsTrue(_expectedRole?.IsNotEditable == role.IsNotEditable);
|
Assert.AreEqual(_expectedRole?.IsNotEditable, role.IsNotEditable);
|
||||||
_role = role;
|
_role = role;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -188,7 +188,7 @@ public class RoleService_Tests
|
|||||||
{
|
{
|
||||||
var role = await _roleService.GetRoleByIdAsync(_role?.Id ?? 0);
|
var role = await _roleService.GetRoleByIdAsync(_role?.Id ?? 0);
|
||||||
Assert.IsNotNull(role);
|
Assert.IsNotNull(role);
|
||||||
Assert.IsTrue(role.Id == _role?.Id);
|
Assert.AreEqual(_role?.Id, _role?.Id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -211,7 +211,7 @@ public class RoleService_Tests
|
|||||||
{
|
{
|
||||||
var role = await _roleService.GetRoleByGuidAsync(_role?.Guid ?? String.Empty);
|
var role = await _roleService.GetRoleByGuidAsync(_role?.Guid ?? String.Empty);
|
||||||
Assert.IsNotNull(role);
|
Assert.IsNotNull(role);
|
||||||
Assert.IsTrue(role.Guid == _role?.Guid);
|
Assert.AreEqual(_role?.Guid, role.Guid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -234,7 +234,7 @@ public class RoleService_Tests
|
|||||||
{
|
{
|
||||||
var role = await _roleService.GetRoleForUser(_role?.Guid);
|
var role = await _roleService.GetRoleForUser(_role?.Guid);
|
||||||
Assert.IsNotNull(role);
|
Assert.IsNotNull(role);
|
||||||
Assert.IsTrue(role.Guid == _role?.Guid);
|
Assert.AreEqual(_role?.Guid, role.Guid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -263,8 +263,8 @@ public class RoleService_Tests
|
|||||||
var roleCreated = await _roleService.CreateRoleAsync(data);
|
var roleCreated = await _roleService.CreateRoleAsync(data);
|
||||||
var role = await _roleService.GetRoleForUser(String.Empty);
|
var role = await _roleService.GetRoleForUser(String.Empty);
|
||||||
Assert.IsNotNull(role);
|
Assert.IsNotNull(role);
|
||||||
Assert.IsTrue(roleCreated?.Guid == role?.Guid);
|
Assert.AreEqual(role?.Guid, roleCreated?.Guid);
|
||||||
Assert.IsTrue(role?.Name == "Default");
|
Assert.AreEqual("Default", role?.Name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -317,8 +317,8 @@ public class RoleService_Tests
|
|||||||
var role = await _roleService.UpdateRoleAsync(data, _role!);
|
var role = await _roleService.UpdateRoleAsync(data, _role!);
|
||||||
Assert.IsInstanceOfType(role, typeof(Role));
|
Assert.IsInstanceOfType(role, typeof(Role));
|
||||||
Assert.IsNotNull(role);
|
Assert.IsNotNull(role);
|
||||||
Assert.IsTrue(data.Name == role.Name);
|
Assert.AreEqual(data.Name, role.Name);
|
||||||
Assert.IsTrue(data.IsNotEditable == role.IsNotEditable);
|
Assert.AreEqual(data.IsNotEditable, role.IsNotEditable);
|
||||||
_role = role;
|
_role = role;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -359,8 +359,8 @@ public class RoleService_Tests
|
|||||||
var roleUpdatedRole = await _roleService.UpdateRoleAsync(updateRoleData, role!);
|
var roleUpdatedRole = await _roleService.UpdateRoleAsync(updateRoleData, role!);
|
||||||
Assert.IsInstanceOfType(roleUpdatedRole, typeof(Role));
|
Assert.IsInstanceOfType(roleUpdatedRole, typeof(Role));
|
||||||
Assert.IsNotNull(roleUpdatedRole);
|
Assert.IsNotNull(roleUpdatedRole);
|
||||||
Assert.IsTrue(roleUpdatedRole.Name == createRoleData.Name);
|
Assert.AreEqual(createRoleData.Name, roleUpdatedRole.Name);
|
||||||
Assert.IsTrue(roleUpdatedRole.IsNotEditable == createRoleData.IsNotEditable);
|
Assert.AreEqual(createRoleData.IsNotEditable, roleUpdatedRole.IsNotEditable);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public class FileUtils_Tests
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
PermissionsFile? permissionsFile = FileUtils.ConvertFileToObject<PermissionsFile>(System.AppDomain.CurrentDomain.BaseDirectory + "Config/permissions.json");
|
PermissionsFile? permissionsFile = FileUtils.ConvertFileToObject<PermissionsFile>(System.AppDomain.CurrentDomain.BaseDirectory + "Config/permissions.json");
|
||||||
Assert.IsTrue(permissionsFile != null);
|
Assert.IsNotNull(permissionsFile);
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class JwtTokenUtils_Tests
|
|||||||
AppSettings appSettings = ProgramUtils.AddConfiguration(ref builder, System.AppDomain.CurrentDomain.BaseDirectory + "/JsonData");
|
AppSettings appSettings = ProgramUtils.AddConfiguration(ref builder, System.AppDomain.CurrentDomain.BaseDirectory + "/JsonData");
|
||||||
JwtTokenUtils jwtUtils = new JwtTokenUtils(appSettings);
|
JwtTokenUtils jwtUtils = new JwtTokenUtils(appSettings);
|
||||||
var jwt = jwtUtils.GenerateToken(_guid);
|
var jwt = jwtUtils.GenerateToken(_guid);
|
||||||
Assert.IsTrue(!String.IsNullOrEmpty(jwt));
|
Assert.IsFalse(String.IsNullOrEmpty(jwt));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -41,7 +41,7 @@ public class JwtTokenUtils_Tests
|
|||||||
JwtTokenUtils jwtUtils = new JwtTokenUtils(appSettings);
|
JwtTokenUtils jwtUtils = new JwtTokenUtils(appSettings);
|
||||||
var jwt = jwtUtils.GenerateToken(_guid);
|
var jwt = jwtUtils.GenerateToken(_guid);
|
||||||
var guid = jwtUtils.ValidateToken($"Bearer {jwt}");
|
var guid = jwtUtils.ValidateToken($"Bearer {jwt}");
|
||||||
Assert.IsTrue(_guid == guid);
|
Assert.AreEqual(_guid, guid);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public class ProgramUtils_Tests
|
|||||||
|
|
||||||
AppSettings appSettings = new AppSettings();
|
AppSettings appSettings = new AppSettings();
|
||||||
OpenApiInfo realOpenApiInfo = ProgramUtils.CreateOpenApiInfo(appSettings);
|
OpenApiInfo realOpenApiInfo = ProgramUtils.CreateOpenApiInfo(appSettings);
|
||||||
Assert.IsTrue(realOpenApiInfo != null);
|
Assert.IsNotNull(realOpenApiInfo);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -118,10 +118,10 @@ public class ProgramUtils_Tests
|
|||||||
OpenApiSettings = null
|
OpenApiSettings = null
|
||||||
};
|
};
|
||||||
OpenApiInfo realOpenApiInfo = ProgramUtils.CreateOpenApiInfo(appSettings);
|
OpenApiInfo realOpenApiInfo = ProgramUtils.CreateOpenApiInfo(appSettings);
|
||||||
Assert.IsTrue(realOpenApiInfo != null);
|
Assert.IsNotNull(realOpenApiInfo);
|
||||||
Assert.IsTrue(realOpenApiInfo.Title == appSettings.Settings.Name);
|
Assert.AreEqual(appSettings.Settings.Name, realOpenApiInfo.Title);
|
||||||
Assert.IsTrue(realOpenApiInfo.Description == appSettings.Settings.Description);
|
Assert.AreEqual(appSettings.Settings.Description, realOpenApiInfo.Description);
|
||||||
Assert.IsTrue(realOpenApiInfo.Version == appSettings.Settings.Version);
|
Assert.AreEqual(appSettings.Settings.Version, realOpenApiInfo.Version);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -151,11 +151,11 @@ public class ProgramUtils_Tests
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
OpenApiInfo realOpenApiInfo = ProgramUtils.CreateOpenApiInfo(appSettings);
|
OpenApiInfo realOpenApiInfo = ProgramUtils.CreateOpenApiInfo(appSettings);
|
||||||
Assert.IsTrue(realOpenApiInfo != null);
|
Assert.IsNotNull(realOpenApiInfo);
|
||||||
Assert.IsTrue(realOpenApiInfo.Title == appSettings.Settings.Name);
|
Assert.AreEqual(appSettings.Settings.Name, realOpenApiInfo.Title);
|
||||||
Assert.IsTrue(realOpenApiInfo.Description == appSettings.Settings.Description);
|
Assert.AreEqual(appSettings.Settings.Description, realOpenApiInfo.Description);
|
||||||
Assert.IsTrue(realOpenApiInfo.Version == appSettings.Settings.Version);
|
Assert.AreEqual(appSettings.Settings.Version, realOpenApiInfo.Version);
|
||||||
Assert.IsTrue(realOpenApiInfo.TermsOfService == null);
|
Assert.IsNull(realOpenApiInfo.TermsOfService);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user