Fixing issues
This commit is contained in:
@@ -43,7 +43,7 @@ public class UserController_Tests
|
|||||||
IConfiguration configuration = TestUtils.CreateConfiguration();
|
IConfiguration configuration = TestUtils.CreateConfiguration();
|
||||||
_userServiceMock = new Mock<IUserService>();
|
_userServiceMock = new Mock<IUserService>();
|
||||||
_roleServiceMock = new Mock<IRoleService>();
|
_roleServiceMock = new Mock<IRoleService>();
|
||||||
_userController = new UserController(configuration, _userServiceMock?.Object, _roleServiceMock.Object);
|
_userController = new UserController(configuration, _userServiceMock.Object, _roleServiceMock.Object);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ public interface IRoleService
|
|||||||
|
|
||||||
public class RoleService : BaseService, IRoleService
|
public class RoleService : BaseService, IRoleService
|
||||||
{
|
{
|
||||||
private readonly NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();
|
|
||||||
public RoleService(
|
public RoleService(
|
||||||
IHttpContextAccessor httpContextAccessor,
|
IHttpContextAccessor httpContextAccessor,
|
||||||
IConfiguration configuration,
|
IConfiguration configuration,
|
||||||
@@ -104,10 +103,9 @@ public class RoleService : BaseService, IRoleService
|
|||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
role = tempRole;
|
role = tempRole;
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
await transaction.RollbackAsync();
|
await transaction.RollbackAsync();
|
||||||
Logger.Error(exception, $"[RoleService][CreateRoleAsync]");
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,10 +130,10 @@ public class RoleService : BaseService, IRoleService
|
|||||||
await _sqlServerContext.SaveChangesAsync();
|
await _sqlServerContext.SaveChangesAsync();
|
||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
await transaction.RollbackAsync();
|
await transaction.RollbackAsync();
|
||||||
Logger.Error(exception, $"[RoleService][UpdateRoleAsync]");
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
return role;
|
return role;
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ public interface IUserService
|
|||||||
|
|
||||||
public class UserService : BaseService, IUserService
|
public class UserService : BaseService, IUserService
|
||||||
{
|
{
|
||||||
private readonly NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();
|
|
||||||
public UserService(
|
public UserService(
|
||||||
IHttpContextAccessor httpContextAccessor,
|
IHttpContextAccessor httpContextAccessor,
|
||||||
IConfiguration configuration,
|
IConfiguration configuration,
|
||||||
@@ -116,10 +115,9 @@ public class UserService : BaseService, IUserService
|
|||||||
await transaction.CommitAsync();
|
await transaction.CommitAsync();
|
||||||
user = tempUser;
|
user = tempUser;
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
await transaction.RollbackAsync();
|
await transaction.RollbackAsync();
|
||||||
Logger.Error(exception, $"[UserService][CreateUserAsync]");
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user