Fixing sonarcloud issues

This commit is contained in:
2025-06-22 22:00:12 +02:00
parent 4c3aa30cbb
commit 9e95ad1cc8
4 changed files with 35 additions and 35 deletions

View File

@@ -189,7 +189,7 @@ public class PermissionService_Tests
{
var updated = await _permissionService.HandleEnabledPermissionSystemAsync(_permissionSystem, false);
Assert.IsTrue(updated);
Assert.IsTrue(!_permissionSystem.Enabled);
Assert.IsFalse(_permissionSystem.Enabled);
}
catch (Exception ex)
@@ -211,7 +211,7 @@ public class PermissionService_Tests
Assert.IsNotNull(permission);
Assert.IsInstanceOfType(permission, typeof(PermissionSystem));
Assert.AreEqual(_permissionSystem.Name, permission.Name);
Assert.IsTrue(permission.Enabled == _permissionSystem.Enabled);
Assert.AreEqual( _permissionSystem.Enabled, permission.Enabled);
}
else
{
@@ -237,7 +237,7 @@ public class PermissionService_Tests
Assert.IsNotNull(permission);
Assert.IsInstanceOfType(permission, typeof(PermissionSystem));
Assert.AreEqual(_permissionSystem.Guid, permission.Guid);
Assert.IsTrue(permission.Enabled == _permissionSystem.Enabled);
Assert.AreEqual( _permissionSystem.Enabled, permission.Enabled);
}
else
{
@@ -362,7 +362,7 @@ public class PermissionService_Tests
{
var updated = await _permissionService.HandleEnabledPermissionModuleAsync(_permissionModule, false);
Assert.IsTrue(updated);
Assert.IsTrue(!_permissionModule.Enabled);
Assert.IsFalse(_permissionModule.Enabled);
}
catch (Exception ex)
@@ -384,7 +384,7 @@ public class PermissionService_Tests
Assert.IsNotNull(permission);
Assert.IsInstanceOfType(permission, typeof(PermissionModule));
Assert.AreEqual(_permissionModule.Name, permission.Name);
Assert.IsTrue(permission.Enabled == _permissionModule.Enabled);
Assert.AreEqual( _permissionModule.Enabled, permission.Enabled);
}
else
{
@@ -410,7 +410,7 @@ public class PermissionService_Tests
Assert.IsNotNull(permission);
Assert.IsInstanceOfType(permission, typeof(PermissionModule));
Assert.AreEqual(_permissionModule.Guid, permission.Guid);
Assert.IsTrue(permission.Enabled == _permissionModule.Enabled);
Assert.AreEqual( _permissionModule.Enabled, permission.Enabled);
}
else
{
@@ -660,7 +660,7 @@ public class PermissionService_Tests
{
var updated = await _permissionService.HandleEnabledPermissionSystemModuleAsync(_permissionSystemModule, false);
Assert.IsTrue(updated);
Assert.IsTrue(!_permissionSystemModule.Enabled);
Assert.IsFalse(_permissionSystemModule.Enabled);
}
catch (Exception ex)
@@ -681,7 +681,7 @@ public class PermissionService_Tests
var permission = await _permissionService.GetPermissionSystemModuleByGuidAsync(_permissionSystemModule.Guid);
Assert.IsNotNull(permission);
Assert.IsInstanceOfType(permission, typeof(PermissionSystemModule));
Assert.IsTrue(permission.Enabled == _permissionSystemModule.Enabled);
Assert.AreEqual( _permissionSystemModule.Enabled, permission.Enabled);
}
else
{
@@ -780,7 +780,7 @@ public class PermissionService_Tests
{
var updated = await _permissionService.HandleEnabledPermissionSystemModuleOperationAsync(_permissionSystemModuleOperation, false);
Assert.IsTrue(updated);
Assert.IsTrue(!_permissionSystemModuleOperation.Enabled);
Assert.IsFalse(_permissionSystemModuleOperation.Enabled);
}
catch (Exception ex)
@@ -801,7 +801,7 @@ public class PermissionService_Tests
var permission = await _permissionService.GetPermissionSystemModuleOperationByGuidAsync(_permissionSystemModuleOperation.Guid);
Assert.IsNotNull(permission);
Assert.IsInstanceOfType(permission, typeof(PermissionSystemModuleOperation));
Assert.IsTrue(permission.Enabled == _permissionSystemModuleOperation.Enabled);
Assert.AreEqual(_permissionSystemModuleOperation.Enabled, permission.Enabled);
}
else
{
@@ -916,7 +916,7 @@ public class PermissionService_Tests
{
var updated = await _permissionService.HandleEnabledRolePermissionSystemModuleOperationAsync(_rolePermissionSystemModuleOperation, false);
Assert.IsTrue(updated);
Assert.IsTrue(!_rolePermissionSystemModuleOperation.Active);
Assert.IsFalse(_rolePermissionSystemModuleOperation.Active);
}
catch (Exception ex)
@@ -937,7 +937,7 @@ public class PermissionService_Tests
var permission = await _permissionService.GetRolePermissionSystemModuleOperationByGuidAsync(_rolePermissionSystemModuleOperation.Guid);
Assert.IsNotNull(permission);
Assert.IsInstanceOfType(permission, typeof(RolePermissionSystemModuleOperation));
Assert.IsTrue(permission.Active == _rolePermissionSystemModuleOperation.Active);
Assert.AreEqual( _rolePermissionSystemModuleOperation.Active, permission.Active);
}
else
{

View File

@@ -79,8 +79,8 @@ public class RoleService_Tests
var role = await _roleService.CreateRoleAsync(data);
Assert.IsInstanceOfType(role, typeof(Role));
Assert.IsNotNull(role);
Assert.IsTrue(_expectedRole?.Name == role.Name);
Assert.IsTrue(_expectedRole?.IsNotEditable == role.IsNotEditable);
Assert.AreEqual(_expectedRole?.Name, role.Name);
Assert.AreEqual(_expectedRole?.IsNotEditable, role.IsNotEditable);
_role = role;
}
else
@@ -188,7 +188,7 @@ public class RoleService_Tests
{
var role = await _roleService.GetRoleByIdAsync(_role?.Id ?? 0);
Assert.IsNotNull(role);
Assert.IsTrue(role.Id == _role?.Id);
Assert.AreEqual(_role?.Id, _role?.Id);
}
else
{
@@ -211,7 +211,7 @@ public class RoleService_Tests
{
var role = await _roleService.GetRoleByGuidAsync(_role?.Guid ?? String.Empty);
Assert.IsNotNull(role);
Assert.IsTrue(role.Guid == _role?.Guid);
Assert.AreEqual(_role?.Guid, role.Guid);
}
else
{
@@ -234,7 +234,7 @@ public class RoleService_Tests
{
var role = await _roleService.GetRoleForUser(_role?.Guid);
Assert.IsNotNull(role);
Assert.IsTrue(role.Guid == _role?.Guid);
Assert.AreEqual(_role?.Guid, role.Guid);
}
else
{
@@ -263,8 +263,8 @@ public class RoleService_Tests
var roleCreated = await _roleService.CreateRoleAsync(data);
var role = await _roleService.GetRoleForUser(String.Empty);
Assert.IsNotNull(role);
Assert.IsTrue(roleCreated?.Guid == role?.Guid);
Assert.IsTrue(role?.Name == "Default");
Assert.AreEqual(role?.Guid, roleCreated?.Guid);
Assert.AreEqual("Default", role?.Name);
}
else
{
@@ -317,8 +317,8 @@ public class RoleService_Tests
var role = await _roleService.UpdateRoleAsync(data, _role!);
Assert.IsInstanceOfType(role, typeof(Role));
Assert.IsNotNull(role);
Assert.IsTrue(data.Name == role.Name);
Assert.IsTrue(data.IsNotEditable == role.IsNotEditable);
Assert.AreEqual(data.Name, role.Name);
Assert.AreEqual(data.IsNotEditable, role.IsNotEditable);
_role = role;
}
else
@@ -359,8 +359,8 @@ public class RoleService_Tests
var roleUpdatedRole = await _roleService.UpdateRoleAsync(updateRoleData, role!);
Assert.IsInstanceOfType(roleUpdatedRole, typeof(Role));
Assert.IsNotNull(roleUpdatedRole);
Assert.IsTrue(roleUpdatedRole.Name == createRoleData.Name);
Assert.IsTrue(roleUpdatedRole.IsNotEditable == createRoleData.IsNotEditable);
Assert.AreEqual(createRoleData.Name, roleUpdatedRole.Name);
Assert.AreEqual(createRoleData.IsNotEditable, roleUpdatedRole.IsNotEditable);
}
else
{

View File

@@ -22,7 +22,7 @@ public class JwtTokenUtils_Tests
AppSettings appSettings = ProgramUtils.AddConfiguration(ref builder, System.AppDomain.CurrentDomain.BaseDirectory + "/JsonData");
JwtTokenUtils jwtUtils = new JwtTokenUtils(appSettings);
var jwt = jwtUtils.GenerateToken(_guid);
Assert.IsTrue(!String.IsNullOrEmpty(jwt));
Assert.IsFalse(String.IsNullOrEmpty(jwt));
}
catch (Exception ex)
{
@@ -41,7 +41,7 @@ public class JwtTokenUtils_Tests
JwtTokenUtils jwtUtils = new JwtTokenUtils(appSettings);
var jwt = jwtUtils.GenerateToken(_guid);
var guid = jwtUtils.ValidateToken($"Bearer {jwt}");
Assert.IsTrue(_guid == guid);
Assert.AreEqual(_guid, guid);
}
catch (Exception ex)
{

View File

@@ -92,7 +92,7 @@ public class ProgramUtils_Tests
AppSettings appSettings = new AppSettings();
OpenApiInfo realOpenApiInfo = ProgramUtils.CreateOpenApiInfo(appSettings);
Assert.IsTrue(realOpenApiInfo != null);
Assert.IsNotNull(realOpenApiInfo);
}
catch (Exception ex)
{
@@ -118,10 +118,10 @@ public class ProgramUtils_Tests
OpenApiSettings = null
};
OpenApiInfo realOpenApiInfo = ProgramUtils.CreateOpenApiInfo(appSettings);
Assert.IsTrue(realOpenApiInfo != null);
Assert.IsTrue(realOpenApiInfo.Title == appSettings.Settings.Name);
Assert.IsTrue(realOpenApiInfo.Description == appSettings.Settings.Description);
Assert.IsTrue(realOpenApiInfo.Version == appSettings.Settings.Version);
Assert.IsNotNull(realOpenApiInfo);
Assert.AreEqual(appSettings.Settings.Name, realOpenApiInfo.Title);
Assert.AreEqual(appSettings.Settings.Description, realOpenApiInfo.Description);
Assert.AreEqual(appSettings.Settings.Version, realOpenApiInfo.Version);
}
catch (Exception ex)
{
@@ -151,11 +151,11 @@ public class ProgramUtils_Tests
}
};
OpenApiInfo realOpenApiInfo = ProgramUtils.CreateOpenApiInfo(appSettings);
Assert.IsTrue(realOpenApiInfo != null);
Assert.IsTrue(realOpenApiInfo.Title == appSettings.Settings.Name);
Assert.IsTrue(realOpenApiInfo.Description == appSettings.Settings.Description);
Assert.IsTrue(realOpenApiInfo.Version == appSettings.Settings.Version);
Assert.IsTrue(realOpenApiInfo.TermsOfService == null);
Assert.IsNotNull(realOpenApiInfo);
Assert.AreEqual(appSettings.Settings.Name, realOpenApiInfo.Title);
Assert.AreEqual(appSettings.Settings.Description, realOpenApiInfo.Description);
Assert.AreEqual(appSettings.Settings.Version, realOpenApiInfo.Version);
Assert.IsNull(realOpenApiInfo.TermsOfService);
}
catch (Exception ex)
{