Fixing sonarcloud issues
This commit is contained in:
23
.editorconfig
Normal file
23
.editorconfig
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# top-most EditorConfig file
|
||||||
|
root = true
|
||||||
|
|
||||||
|
# Core EditorConfig properties
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
|
||||||
|
[*.cs]
|
||||||
|
dotnet_naming_style.pascal_case.capitalization = pascal_case
|
||||||
|
dotnet_naming_rule.types.symbols = types
|
||||||
|
dotnet_naming_rule.types.style = pascal_case
|
||||||
|
dotnet_naming_rule.types.severity = warning
|
||||||
|
|
||||||
|
|
||||||
|
csharp_prefer_braced_block = true:suggestion
|
||||||
|
csharp_preserve_single_line_blocks = true
|
||||||
|
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
|
||||||
@@ -66,7 +66,7 @@ public class AuthController_Tests
|
|||||||
var result = (BaseResponse<object>)response.Value;
|
var result = (BaseResponse<object>)response.Value;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(result.Status == StatusCodes.Status200OK);
|
Assert.AreEqual(StatusCodes.Status200OK, result.Status);
|
||||||
Assert.IsInstanceOfType(result.Data, typeof(AuthenticatedUser));
|
Assert.IsInstanceOfType(result.Data, typeof(AuthenticatedUser));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -103,7 +103,7 @@ public class AuthController_Tests
|
|||||||
// var result = (BaseResponse<object>)response.Value;
|
// var result = (BaseResponse<object>)response.Value;
|
||||||
// if (result != null)
|
// if (result != null)
|
||||||
// {
|
// {
|
||||||
// Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest);
|
// Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status);
|
||||||
// Assert.IsTrue(result.Message == "Request is not well formed");
|
// Assert.IsTrue(result.Message == "Request is not well formed");
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
@@ -173,7 +173,7 @@ public class AuthController_Tests
|
|||||||
// var result = (BaseResponse<object>)response.Value;
|
// var result = (BaseResponse<object>)response.Value;
|
||||||
// if (result != null)
|
// if (result != null)
|
||||||
// {
|
// {
|
||||||
// Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest);
|
// Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status);
|
||||||
// Assert.IsTrue(result.Message == "Request is not well formed");
|
// Assert.IsTrue(result.Message == "Request is not well formed");
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
@@ -212,8 +212,8 @@ public class AuthController_Tests
|
|||||||
var result = (BaseResponse<object>)response.Value;
|
var result = (BaseResponse<object>)response.Value;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(result.Status == StatusCodes.Status500InternalServerError);
|
Assert.AreEqual(StatusCodes.Status500InternalServerError, result.Status);
|
||||||
Assert.AreEqual("Something went wrong. Unexpected error", result.Message );
|
Assert.AreEqual("Something went wrong. Unexpected error", result.Message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class RoleController_Tests
|
|||||||
var result = (BaseResponse<object>)response.Value;
|
var result = (BaseResponse<object>)response.Value;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(result.Status == StatusCodes.Status200OK);
|
Assert.AreEqual(StatusCodes.Status200OK, result.Status);
|
||||||
Assert.IsInstanceOfType(result.Data, typeof(RoleDto));
|
Assert.IsInstanceOfType(result.Data, typeof(RoleDto));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -110,7 +110,7 @@ public class RoleController_Tests
|
|||||||
// var result = (BaseResponse<object>)response.Value;
|
// var result = (BaseResponse<object>)response.Value;
|
||||||
// if (result != null)
|
// if (result != null)
|
||||||
// {
|
// {
|
||||||
// Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest);
|
// Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status);
|
||||||
// Assert.IsTrue(result.Message == "Request is not well formed");
|
// Assert.IsTrue(result.Message == "Request is not well formed");
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
@@ -172,7 +172,7 @@ public class RoleController_Tests
|
|||||||
// var result = (BaseResponse<object>)response.Value;
|
// var result = (BaseResponse<object>)response.Value;
|
||||||
// if (result != null)
|
// if (result != null)
|
||||||
// {
|
// {
|
||||||
// Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest);
|
// Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status);
|
||||||
// Assert.IsTrue(result.Message == "Request is not well formed");
|
// Assert.IsTrue(result.Message == "Request is not well formed");
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
@@ -207,8 +207,8 @@ public class RoleController_Tests
|
|||||||
var result = (BaseResponse<object>)response.Value;
|
var result = (BaseResponse<object>)response.Value;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(result.Status == StatusCodes.Status500InternalServerError);
|
Assert.AreEqual(StatusCodes.Status500InternalServerError, result.Status);
|
||||||
Assert.AreEqual("Something went wrong. Unexpected error", result.Message );
|
Assert.AreEqual("Something went wrong. Unexpected error", result.Message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -260,7 +260,7 @@ public class RoleController_Tests
|
|||||||
var result = (BaseResponse<object>)response.Value;
|
var result = (BaseResponse<object>)response.Value;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(result.Status == StatusCodes.Status200OK);
|
Assert.AreEqual(StatusCodes.Status200OK, result.Status);
|
||||||
Assert.IsInstanceOfType(result.Data, typeof(RoleDto));
|
Assert.IsInstanceOfType(result.Data, typeof(RoleDto));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -302,8 +302,8 @@ public class RoleController_Tests
|
|||||||
var result = (BaseResponse<object>)response.Value;
|
var result = (BaseResponse<object>)response.Value;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest);
|
Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status);
|
||||||
Assert.AreEqual("Invalid name", result.Message );
|
Assert.AreEqual("Invalid name", result.Message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -346,7 +346,7 @@ public class RoleController_Tests
|
|||||||
// var result = (BaseResponse<object>)response.Value;
|
// var result = (BaseResponse<object>)response.Value;
|
||||||
// if (result != null)
|
// if (result != null)
|
||||||
// {
|
// {
|
||||||
// Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest);
|
// Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status);
|
||||||
// Assert.IsTrue(result.Message == "Request is not well formed");
|
// Assert.IsTrue(result.Message == "Request is not well formed");
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
@@ -396,8 +396,8 @@ public class RoleController_Tests
|
|||||||
var result = (BaseResponse<object>)response.Value;
|
var result = (BaseResponse<object>)response.Value;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest);
|
Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status);
|
||||||
Assert.IsTrue(result.Message == "Not created");
|
Assert.AreEqual("Not created", result.Message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -446,7 +446,7 @@ public class RoleController_Tests
|
|||||||
// var result = (BaseResponse<object>)response.Value;
|
// var result = (BaseResponse<object>)response.Value;
|
||||||
// if (result != null)
|
// if (result != null)
|
||||||
// {
|
// {
|
||||||
// Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest);
|
// Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status);
|
||||||
// Assert.IsTrue(result.Message == "Request is not well formed");
|
// Assert.IsTrue(result.Message == "Request is not well formed");
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
@@ -499,8 +499,8 @@ public class RoleController_Tests
|
|||||||
var result = (BaseResponse<object>)response.Value;
|
var result = (BaseResponse<object>)response.Value;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(result.Status == StatusCodes.Status500InternalServerError);
|
Assert.AreEqual(StatusCodes.Status500InternalServerError, result.Status);
|
||||||
Assert.AreEqual("Something went wrong. Unexpected error", result.Message );
|
Assert.AreEqual("Something went wrong. Unexpected error", result.Message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -560,7 +560,7 @@ public class RoleController_Tests
|
|||||||
// var result = (BaseResponse<object>)response.Value;
|
// var result = (BaseResponse<object>)response.Value;
|
||||||
// if (result != null)
|
// if (result != null)
|
||||||
// {
|
// {
|
||||||
// Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest);
|
// Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status);
|
||||||
// Assert.IsTrue(result.Message == "Request is not well formed");
|
// Assert.IsTrue(result.Message == "Request is not well formed");
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
@@ -622,7 +622,7 @@ public class RoleController_Tests
|
|||||||
// var result = (BaseResponse<object>)response.Value;
|
// var result = (BaseResponse<object>)response.Value;
|
||||||
// if (result != null)
|
// if (result != null)
|
||||||
// {
|
// {
|
||||||
// Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest);
|
// Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status);
|
||||||
// Assert.IsTrue(result.Message == "Request is not well formed");
|
// Assert.IsTrue(result.Message == "Request is not well formed");
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
@@ -657,8 +657,8 @@ public class RoleController_Tests
|
|||||||
var result = (BaseResponse<object>)response.Value;
|
var result = (BaseResponse<object>)response.Value;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(result.Status == StatusCodes.Status500InternalServerError);
|
Assert.AreEqual(StatusCodes.Status500InternalServerError, result.Status);
|
||||||
Assert.AreEqual("Something went wrong. Unexpected error", result.Message );
|
Assert.AreEqual("Something went wrong. Unexpected error", result.Message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -713,7 +713,7 @@ public class RoleController_Tests
|
|||||||
var result = (BaseResponse<object>)response.Value;
|
var result = (BaseResponse<object>)response.Value;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(result.Status == StatusCodes.Status200OK);
|
Assert.AreEqual(StatusCodes.Status200OK, result.Status);
|
||||||
Assert.IsInstanceOfType(result.Data, typeof(RoleDto));
|
Assert.IsInstanceOfType(result.Data, typeof(RoleDto));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -791,8 +791,8 @@ public class RoleController_Tests
|
|||||||
var result = (BaseResponse<object>)response.Value;
|
var result = (BaseResponse<object>)response.Value;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest);
|
Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status);
|
||||||
Assert.AreEqual("Invalid name", result.Message );
|
Assert.AreEqual("Invalid name", result.Message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -837,7 +837,7 @@ public class RoleController_Tests
|
|||||||
var result = (BaseResponse<object>)response.Value;
|
var result = (BaseResponse<object>)response.Value;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest);
|
Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status);
|
||||||
Assert.IsTrue(result.Message == "This role is not editable");
|
Assert.IsTrue(result.Message == "This role is not editable");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -879,7 +879,7 @@ public class RoleController_Tests
|
|||||||
// var result = (BaseResponse<object>)response.Value;
|
// var result = (BaseResponse<object>)response.Value;
|
||||||
// if (result != null)
|
// if (result != null)
|
||||||
// {
|
// {
|
||||||
// Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest);
|
// Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status);
|
||||||
// Assert.IsTrue(result.Message == "Request is not well formed");
|
// Assert.IsTrue(result.Message == "Request is not well formed");
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
@@ -927,7 +927,7 @@ public class RoleController_Tests
|
|||||||
// var result = (BaseResponse<object>)response.Value;
|
// var result = (BaseResponse<object>)response.Value;
|
||||||
// if (result != null)
|
// if (result != null)
|
||||||
// {
|
// {
|
||||||
// Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest);
|
// Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status);
|
||||||
// Assert.IsTrue(result.Message == "Request is not well formed");
|
// Assert.IsTrue(result.Message == "Request is not well formed");
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
@@ -981,8 +981,8 @@ public class RoleController_Tests
|
|||||||
var result = (BaseResponse<object>)response.Value;
|
var result = (BaseResponse<object>)response.Value;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(result.Status == StatusCodes.Status500InternalServerError);
|
Assert.AreEqual(StatusCodes.Status500InternalServerError, result.Status);
|
||||||
Assert.AreEqual("Something went wrong. Unexpected error", result.Message );
|
Assert.AreEqual("Something went wrong. Unexpected error", result.Message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public class UserController_Tests
|
|||||||
var result = (BaseResponse<object>)response.Value;
|
var result = (BaseResponse<object>)response.Value;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(result.Status == StatusCodes.Status200OK);
|
Assert.AreEqual(StatusCodes.Status200OK, result.Status);
|
||||||
Assert.IsInstanceOfType(result.Data, typeof(UserDto));
|
Assert.IsInstanceOfType(result.Data, typeof(UserDto));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -120,7 +120,7 @@ public class UserController_Tests
|
|||||||
// var result = (BaseResponse<object>)response.Value;
|
// var result = (BaseResponse<object>)response.Value;
|
||||||
// if (result != null)
|
// if (result != null)
|
||||||
// {
|
// {
|
||||||
// Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest);
|
// Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status);
|
||||||
// Assert.IsTrue(result.Message == "Request is not well formed");
|
// Assert.IsTrue(result.Message == "Request is not well formed");
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
@@ -182,7 +182,7 @@ public class UserController_Tests
|
|||||||
// var result = (BaseResponse<object>)response.Value;
|
// var result = (BaseResponse<object>)response.Value;
|
||||||
// if (result != null)
|
// if (result != null)
|
||||||
// {
|
// {
|
||||||
// Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest);
|
// Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status);
|
||||||
// Assert.IsTrue(result.Message == "Request is not well formed");
|
// Assert.IsTrue(result.Message == "Request is not well formed");
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
@@ -217,8 +217,8 @@ public class UserController_Tests
|
|||||||
var result = (BaseResponse<object>)response.Value;
|
var result = (BaseResponse<object>)response.Value;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(result.Status == StatusCodes.Status500InternalServerError);
|
Assert.AreEqual(StatusCodes.Status500InternalServerError, result.Status);
|
||||||
Assert.AreEqual("Something went wrong. Unexpected error", result.Message );
|
Assert.AreEqual("Something went wrong. Unexpected error", result.Message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -270,7 +270,7 @@ public class UserController_Tests
|
|||||||
var result = (BaseResponse<object>)response.Value;
|
var result = (BaseResponse<object>)response.Value;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(result.Status == StatusCodes.Status200OK);
|
Assert.AreEqual(StatusCodes.Status200OK, result.Status);
|
||||||
Assert.IsInstanceOfType(result.Data, typeof(UserDto));
|
Assert.IsInstanceOfType(result.Data, typeof(UserDto));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -316,7 +316,7 @@ public class UserController_Tests
|
|||||||
var result = (BaseResponse<object>)response.Value;
|
var result = (BaseResponse<object>)response.Value;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest);
|
Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status);
|
||||||
Assert.IsTrue(result.Message == "Invalid email");
|
Assert.IsTrue(result.Message == "Invalid email");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -367,7 +367,7 @@ public class UserController_Tests
|
|||||||
var result = (BaseResponse<object>)response.Value;
|
var result = (BaseResponse<object>)response.Value;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest);
|
Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status);
|
||||||
Assert.IsTrue(result.Message == "Role not found");
|
Assert.IsTrue(result.Message == "Role not found");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -412,7 +412,7 @@ public class UserController_Tests
|
|||||||
// var result = (BaseResponse<object>)response.Value;
|
// var result = (BaseResponse<object>)response.Value;
|
||||||
// if (result != null)
|
// if (result != null)
|
||||||
// {
|
// {
|
||||||
// Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest);
|
// Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status);
|
||||||
// Assert.IsTrue(result.Message == "Request is not well formed");
|
// Assert.IsTrue(result.Message == "Request is not well formed");
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
@@ -467,8 +467,8 @@ public class UserController_Tests
|
|||||||
var result = (BaseResponse<object>)response.Value;
|
var result = (BaseResponse<object>)response.Value;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest);
|
Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status);
|
||||||
Assert.IsTrue(result.Message == "Not created");
|
Assert.AreEqual("Not created", result.Message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -520,7 +520,7 @@ public class UserController_Tests
|
|||||||
// var result = (BaseResponse<object>)response.Value;
|
// var result = (BaseResponse<object>)response.Value;
|
||||||
// if (result != null)
|
// if (result != null)
|
||||||
// {
|
// {
|
||||||
// Assert.IsTrue(result.Status == StatusCodes.Status400BadRequest);
|
// Assert.AreEqual(StatusCodes.Status400BadRequest, result.Status);
|
||||||
// Console.WriteLine(JsonConvert.SerializeObject(result));
|
// Console.WriteLine(JsonConvert.SerializeObject(result));
|
||||||
// Assert.IsTrue(result.Message == "Request is not well formed");
|
// Assert.IsTrue(result.Message == "Request is not well formed");
|
||||||
// }
|
// }
|
||||||
@@ -582,8 +582,8 @@ public class UserController_Tests
|
|||||||
var result = (BaseResponse<object>)response.Value;
|
var result = (BaseResponse<object>)response.Value;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
Assert.IsTrue(result.Status == StatusCodes.Status500InternalServerError);
|
Assert.AreEqual(StatusCodes.Status500InternalServerError, result.Status);
|
||||||
Assert.AreEqual("Something went wrong. Unexpected error", result.Message );
|
Assert.AreEqual("Something went wrong. Unexpected error", result.Message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -366,7 +366,7 @@ public class UserService_Tests
|
|||||||
var user = await _userService.UpdateUserPasswordAsync(_user!, "this-is-a-new-password");
|
var user = await _userService.UpdateUserPasswordAsync(_user!, "this-is-a-new-password");
|
||||||
Assert.IsInstanceOfType(user, typeof(User));
|
Assert.IsInstanceOfType(user, typeof(User));
|
||||||
Assert.IsNotNull(user);
|
Assert.IsNotNull(user);
|
||||||
Assert.IsTrue(user.Password != oldPassword);
|
Assert.AreNotEqual(user.Password, oldPassword);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -424,7 +424,7 @@ public class UserService_Tests
|
|||||||
var user = await _userService.UpdateUserRoleAsync(_user!, role);
|
var user = await _userService.UpdateUserRoleAsync(_user!, role);
|
||||||
Assert.IsInstanceOfType(user, typeof(User));
|
Assert.IsInstanceOfType(user, typeof(User));
|
||||||
Assert.IsNotNull(user);
|
Assert.IsNotNull(user);
|
||||||
Assert.IsTrue(user.Role?.Id != oldRole?.Id);
|
Assert.AreNotEqual(user.Role?.Id, oldRole?.Id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -67,9 +67,9 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (await this._roleService.CheckIfNameIsValid(request.Data.Name))
|
if (await this._roleService.CheckIfNameIsValid(request!.Data!.Name))
|
||||||
{
|
{
|
||||||
var role = await this._roleService.CreateRoleAsync(request.Data);
|
var role = await this._roleService.CreateRoleAsync(request!.Data);
|
||||||
|
|
||||||
if (role == null || String.IsNullOrEmpty(role.Guid))
|
if (role == null || String.IsNullOrEmpty(role.Guid))
|
||||||
{
|
{
|
||||||
@@ -121,8 +121,8 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
await this._roleService.CheckIfNameIsValid(request.Data.Name) ||
|
await this._roleService.CheckIfNameIsValid(request!.Data!.Name) ||
|
||||||
await this._roleService.CheckIfNameIsValid(request.Data.Name, guid)
|
await this._roleService.CheckIfNameIsValid(request!.Data!.Name, guid)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
role = await this._roleService.UpdateRoleAsync(request.Data, role);
|
role = await this._roleService.UpdateRoleAsync(request.Data, role);
|
||||||
|
|||||||
@@ -73,13 +73,13 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
|||||||
{
|
{
|
||||||
if (await this._userService.CheckIfEmailIsValid(request!.Data!.Email))
|
if (await this._userService.CheckIfEmailIsValid(request!.Data!.Email))
|
||||||
{
|
{
|
||||||
var role = await this._roleService.GetRoleForUser(request.Data.RoleGuid);
|
var role = await this._roleService.GetRoleForUser(request!.Data!.RoleGuid);
|
||||||
if (role == null)
|
if (role == null)
|
||||||
{
|
{
|
||||||
return BadRequest("Role not found");
|
return BadRequest("Role not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
var user = await this._userService.CreateUserAsync(request.Data, role);
|
var user = await this._userService.CreateUserAsync(request!.Data, role);
|
||||||
|
|
||||||
if (user == null || String.IsNullOrEmpty(user.Guid))
|
if (user == null || String.IsNullOrEmpty(user.Guid))
|
||||||
{
|
{
|
||||||
@@ -119,7 +119,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var user = await this._userService.GetUserByGuidAsync(guid);
|
var user = await this._userService.GetUserByGuidAsync(guid);
|
||||||
if(user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
@@ -154,7 +154,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var user = await this._userService.GetUserByGuidAsync(guid);
|
var user = await this._userService.GetUserByGuidAsync(guid);
|
||||||
if(user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,7 @@ namespace BasicDotnetTemplate.MainProject.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
var user = await this._userService.GetUserByGuidAsync(guid);
|
var user = await this._userService.GetUserByGuidAsync(guid);
|
||||||
if(user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public class UserRole
|
|||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
public UserRole() {}
|
public UserRole() { }
|
||||||
|
|
||||||
public UserRole(DatabaseSqlServer.Role role)
|
public UserRole(DatabaseSqlServer.Role role)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ public class OperationInfo
|
|||||||
{
|
{
|
||||||
#nullable enable
|
#nullable enable
|
||||||
public string? Operation { get; set; }
|
public string? Operation { get; set; }
|
||||||
public List<string>? Roles {get; set; }
|
public List<string>? Roles { get; set; }
|
||||||
#nullable disable
|
#nullable disable
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,6 @@ public class PermissionInfo
|
|||||||
{
|
{
|
||||||
#nullable enable
|
#nullable enable
|
||||||
public string? System { get; set; }
|
public string? System { get; set; }
|
||||||
public List<RolePermissionModuleOperation>? RolePermissionModuleOperations {get; set; }
|
public List<RolePermissionModuleOperation>? RolePermissionModuleOperations { get; set; }
|
||||||
#nullable disable
|
#nullable disable
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using NLog;
|
using NLog;
|
||||||
using BasicDotnetTemplate.MainProject.Models.Settings;
|
using BasicDotnetTemplate.MainProject.Models.Settings;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using BasicDotnetTemplate.MainProject.Utils;
|
using BasicDotnetTemplate.MainProject.Utils;
|
||||||
|
|||||||
Reference in New Issue
Block a user