Skip to content

Commit

Permalink
EHD-1432: Reduce use of interfaces: IScopeBusinessLogic
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgriff committed Nov 20, 2024
1 parent f4b56c4 commit 928b952
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void BeforeEach()
private Mock<IDataRepository> mockDataRepository;

// sut
private IScopeBusinessLogic scopeBusinessLogic;
private WebUI.BusinessLogic.Services.ScopeBusinessLogic scopeBusinessLogic;

[TestCase(SectorTypes.Private)]
[TestCase(SectorTypes.Public)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void BeforeEach()
private List<Organisation> testOrgs;

// sut
private IScopeBusinessLogic scopeBusinessLogic;
private WebUI.BusinessLogic.Services.ScopeBusinessLogic scopeBusinessLogic;

[TestCase(1)]
[TestCase(2)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class ScopeBusinessLogicTests : AssertionHelper

private IList<Organisation> testOrgData;
private IList<OrganisationScope> testOrgScopeData;
public IScopeBusinessLogic testScopeBL;
public ScopeBusinessLogic testScopeBL;

#region Test Data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,7 @@ public static IContainer BuildContainerIoC(params object[] dbObjects)
builder.RegisterInstance(Config.Configuration);
builder.RegisterType<UpdateFromCompaniesHouseService>().As<UpdateFromCompaniesHouseService>().InstancePerLifetimeScope();

builder.Register(
c => c.ResolveAsMock<ScopeBusinessLogic>(
false,
typeof(IDataRepository))
.Object)
.As<IScopeBusinessLogic>()
.InstancePerLifetimeScope();
builder.RegisterType<ScopeBusinessLogic>().As<ScopeBusinessLogic>().SingleInstance();

builder.Register(g => new MockGovNotify()).As<IGovNotifyAPI>().SingleInstance();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ namespace GenderPayGap.WebUI.BackgroundJobs.ScheduledJobs

public class SetPresumedScopesJob
{
private readonly IScopeBusinessLogic scopeBusinessLogic;
private readonly ScopeBusinessLogic scopeBusinessLogic;

public SetPresumedScopesJob(
IScopeBusinessLogic scopeBusinessLogic)
ScopeBusinessLogic scopeBusinessLogic)
{
this.scopeBusinessLogic = scopeBusinessLogic;
}
Expand Down
16 changes: 1 addition & 15 deletions GenderPayGap.WebUI/BusinessLogic/Services/ScopeBusinessLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,7 @@
namespace GenderPayGap.WebUI.BusinessLogic.Services
{

public interface IScopeBusinessLogic
{

OrganisationScope GetLatestScopeBySnapshotYear(long organisationId, int snapshotYear = 0);

void SetPresumedScopes();

HashSet<OrganisationMissingScope> FindOrgsWhereScopeNotSet();
bool FillMissingScopes(Organisation org);

void SetScopeStatuses();

}

public class ScopeBusinessLogic : IScopeBusinessLogic
public class ScopeBusinessLogic
{

public ScopeBusinessLogic(IDataRepository dataRepo)
Expand Down
2 changes: 1 addition & 1 deletion GenderPayGap.WebUI/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public IContainer BuildContainerIoC(IServiceCollection services)
builder.RegisterType<ReturnService>().As<ReturnService>().InstancePerLifetimeScope();
builder.RegisterType<DraftReturnService>().As<DraftReturnService>().InstancePerLifetimeScope();

builder.RegisterType<ScopeBusinessLogic>().As<IScopeBusinessLogic>().InstancePerLifetimeScope();
builder.RegisterType<ScopeBusinessLogic>().As<ScopeBusinessLogic>().InstancePerLifetimeScope();

builder.RegisterType<UpdateFromCompaniesHouseService>().As<UpdateFromCompaniesHouseService>().InstancePerLifetimeScope();

Expand Down

0 comments on commit 928b952

Please sign in to comment.