Update RegionServiceTests for the new RegionService constructor
RegionService now depends on ICurrentUserService and IScopeAccessService for the target/budget/tax-rule/agency scope checks; update the existing CRUD test setup to mock them accordingly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using Distribution.Features.Region;
|
using Distribution.Features.Region;
|
||||||
|
using Distribution.Infra.Authorization;
|
||||||
using Distribution.Infra.UoW;
|
using Distribution.Infra.UoW;
|
||||||
using Distribution.Models;
|
using Distribution.Models;
|
||||||
using Moq;
|
using Moq;
|
||||||
@@ -10,11 +11,14 @@ public class RegionServiceTests
|
|||||||
{
|
{
|
||||||
private readonly Mock<IRegionRepository> _repo = new();
|
private readonly Mock<IRegionRepository> _repo = new();
|
||||||
private readonly Mock<IUnitOfWork> _uow = new();
|
private readonly Mock<IUnitOfWork> _uow = new();
|
||||||
|
private readonly Mock<ICurrentUserService> _currentUser = new();
|
||||||
|
private readonly Mock<IScopeAccessService> _scopeAccess = new();
|
||||||
private readonly RegionService _sut;
|
private readonly RegionService _sut;
|
||||||
|
|
||||||
public RegionServiceTests()
|
public RegionServiceTests()
|
||||||
{
|
{
|
||||||
_sut = new RegionService(_repo.Object, _uow.Object);
|
_currentUser.Setup(u => u.RoleLevel).Returns(60);
|
||||||
|
_sut = new RegionService(_repo.Object, _uow.Object, _currentUser.Object, _scopeAccess.Object);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Region ActiveRegion(string name = "North") =>
|
private static Region ActiveRegion(string name = "North") =>
|
||||||
|
|||||||
Reference in New Issue
Block a user