Skip to content

Commit

Permalink
Merge pull request #722 from SkillsFundingAgency/MF-513-Remove_Readon…
Browse files Browse the repository at this point in the history
…ly_DbContext

Mf 513 remove readonly db context
  • Loading branch information
SijiOdun authored May 1, 2020
2 parents 514fb42 + c9b13eb commit 133eb2f
Show file tree
Hide file tree
Showing 17 changed files with 55 additions and 212 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public static void Initialize(Registry registry)
registry.IncludeRegistry<ConfigurationRegistry>();
registry.IncludeRegistry<CurrentDateTimeRegistry>();
registry.IncludeRegistry<DataRegistry>();
registry.IncludeRegistry<ReadOnlyDataRegistry>();
registry.IncludeRegistry<DomainServiceRegistry>();
registry.IncludeRegistry<EntityFrameworkCoreUnitOfWorkRegistry<ProviderCommitmentsDbContext>>();
registry.IncludeRegistry<EmployerAccountsRegistry>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class GetApprenticeshipPerformanceTests : SearchParameterServiceTestBase
[Test, RecursiveMoqAutoData]
public async Task Then_Will_Not_Search_For_Apprenticeships_That_Will_Not_Be_Used_On_Current_Page(
ApprenticeshipSearchParameters searchParameters,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext,
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext,
[Frozen] Mock<IMapper<Apprenticeship, GetApprenticeshipsQueryResult.ApprenticeshipDetails>> mockMapper,
ApprenticeshipSearchService service)
{
Expand All @@ -46,7 +46,7 @@ public async Task Then_Will_Not_Search_For_Apprenticeships_That_Will_Not_Be_Used
[Test, RecursiveMoqAutoData]
public async Task Then_Will_Not_Search_For_Apprenticeships_That_Will_Be_Skipped(
ApprenticeshipSearchParameters searchParameters,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext,
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext,
[Frozen] Mock<IMapper<Apprenticeship, GetApprenticeshipsQueryResult.ApprenticeshipDetails>> mockMapper,
ApprenticeshipSearchService service)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task ThenQueriesApprenticeshipsWithEmployerIdWhenNotOrdering(
List<Apprenticeship> apprenticeships,
[Frozen]GetApprenticeshipsQuery query,
[Frozen] Mock<IApprenticeshipSearch> mockSearch,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext,
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext,
[Frozen] Mock<IMapper<Apprenticeship, GetApprenticeshipsQueryResult.ApprenticeshipDetails>> mockMapper,
GetApprenticeshipsQueryHandler handler)
{
Expand Down Expand Up @@ -53,7 +53,7 @@ public async Task ThenQueriesApprenticeshipsWithEmployerIdWhenOrdering(
[Frozen]GetApprenticeshipsQuery query,
List<Apprenticeship> apprenticeships,
GetApprenticeshipsQueryResult.ApprenticeshipDetails apprenticeshipDetails,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext,
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext,
[Frozen] Mock<IApprenticeshipSearch> mockSearch,
[Frozen] Mock<IMapper<Apprenticeship, GetApprenticeshipsQueryResult.ApprenticeshipDetails>> mockMapper,
GetApprenticeshipsQueryHandler handler)
Expand Down Expand Up @@ -88,7 +88,7 @@ public async Task ThenQueriesApprenticeshipsWithEmployerIdWhenOrderingInReverse(
[Frozen]GetApprenticeshipsQuery query,
List<Apprenticeship> apprenticeships,
GetApprenticeshipsQueryResult.ApprenticeshipDetails apprenticeshipDetails,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext,
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext,
[Frozen] Mock<IApprenticeshipSearch> mockSearch,
[Frozen] Mock<IMapper<Apprenticeship, GetApprenticeshipsQueryResult.ApprenticeshipDetails>> mockMapper,
GetApprenticeshipsQueryHandler handler)
Expand Down Expand Up @@ -121,7 +121,7 @@ public async Task ThenWillReturnCurrentSelectedPage(
[Frozen]GetApprenticeshipsQuery query,
List<Apprenticeship> apprenticeships,
ApprenticeshipSearchResult searchResult,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext,
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext,
[Frozen] Mock<IApprenticeshipSearch> mockSearch,
[Frozen] Mock<IMapper<Apprenticeship, GetApprenticeshipsQueryResult.ApprenticeshipDetails>> mockMapper,
GetApprenticeshipsQueryHandler handler)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public async Task ThenReturnUnsortedApprenticeshipsWhenNotOrdering(
List<Apprenticeship> apprenticeships,
[Frozen]GetApprenticeshipsQuery query,
[Frozen] Mock<IApprenticeshipSearch> mockSearch,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext,
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext,
[Frozen] Mock<IMapper<Apprenticeship, GetApprenticeshipsQueryResult.ApprenticeshipDetails>> mockMapper,
GetApprenticeshipsQueryHandler handler)
{
Expand Down Expand Up @@ -58,7 +58,7 @@ public async Task ThenReturnsOrderedApprenticeshipsWhenOrdering(

[Frozen]GetApprenticeshipsQuery query,
List<Apprenticeship> apprenticeships,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext,
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext,
[Frozen] Mock<IApprenticeshipSearch> mockSearch,
[Frozen] Mock<IMapper<Apprenticeship, GetApprenticeshipsQueryResult.ApprenticeshipDetails>> mockMapper,
GetApprenticeshipsQueryHandler handler)
Expand Down Expand Up @@ -95,7 +95,7 @@ public async Task ThenReturnReverseOrderedApprenticeshipsWhenOrderingInReverse(

[Frozen]GetApprenticeshipsQuery query,
List<Apprenticeship> apprenticeships,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext,
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext,
[Frozen] Mock<IApprenticeshipSearch> mockSearch,
[Frozen] Mock<IMapper<Apprenticeship, GetApprenticeshipsQueryResult.ApprenticeshipDetails>> mockMapper,
GetApprenticeshipsQueryHandler handler)
Expand Down Expand Up @@ -132,7 +132,7 @@ public async Task ThenReturnsMappedApprenticeships(
[Frozen]GetApprenticeshipsQuery query,
List<Apprenticeship> apprenticeships,
[Frozen]GetApprenticeshipsQueryResult.ApprenticeshipDetails apprenticeshipDetails,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext,
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext,
[Frozen] Mock<IApprenticeshipSearch> search,
[Frozen] Mock<IMapper<Apprenticeship, GetApprenticeshipsQueryResult.ApprenticeshipDetails>> mockMapper,
GetApprenticeshipsQueryHandler handler)
Expand Down Expand Up @@ -171,7 +171,7 @@ public async Task ThenReturnsApprenticeshipsData(
GetApprenticeshipsQueryResult.ApprenticeshipDetails apprenticeshipDetails,
[Frozen]GetApprenticeshipsQuery query,
[Frozen] Mock<IApprenticeshipSearch> search,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext,
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext,
[Frozen] Mock<IMapper<Apprenticeship, GetApprenticeshipsQueryResult.ApprenticeshipDetails>> mockMapper,
GetApprenticeshipsQueryHandler handler)
{
Expand Down Expand Up @@ -210,7 +210,7 @@ public async Task ThenReturnsPageNumber(
[Frozen]GetApprenticeshipsQuery query,
List<Apprenticeship> apprenticeships,
ApprenticeshipSearchResult searchResult,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext,
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext,
[Frozen] Mock<IApprenticeshipSearch> search,
GetApprenticeshipsQueryHandler handler)
{
Expand Down Expand Up @@ -239,7 +239,7 @@ public async Task ThenIsSetToBeFromProvider(
GetApprenticeshipsQueryResult.ApprenticeshipDetails apprenticeshipDetails,
[Frozen]GetApprenticeshipsQuery query,
[Frozen] Mock<IApprenticeshipSearch> search,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext,
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext,
[Frozen] Mock<IMapper<Apprenticeship, GetApprenticeshipsQueryResult.ApprenticeshipDetails>> mockMapper,
GetApprenticeshipsQueryHandler handler)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class WhenDownloadingApprentices : SearchParameterServiceTestBase
[Test, MoqAutoData]
public async Task Then_Downloads_Are_Restricted_To_Twelve_Months_for_Default_Search(
ApprenticeshipSearchParameters searchParameters,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext)
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext)
{
//Arrange
searchParameters.PageNumber = 0;
Expand Down Expand Up @@ -49,7 +49,7 @@ public async Task Then_Downloads_Are_Restricted_To_Twelve_Months_for_Default_Sea
[Test, MoqAutoData]
public async Task Then_Downloads_Are_Restricted_To_Twelve_Months_Normal_Sort(
OrderedApprenticeshipSearchParameters searchParameters,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext)
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext)
{
//Arrange
searchParameters.FieldName = nameof(Apprenticeship.FirstName);
Expand Down Expand Up @@ -81,7 +81,7 @@ public async Task Then_Downloads_Are_Restricted_To_Twelve_Months_Normal_Sort(
[Test, MoqAutoData]
public async Task Then_Downloads_Are_Restricted_To_Twelve_Months_For_Reverse_Sort(
ReverseOrderedApprenticeshipSearchParameters searchParameters,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext)
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext)
{
//Arrange
searchParameters.FieldName = nameof(Apprenticeship.FirstName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class WhenGettingSortedApprenticeships : SearchParameterServiceTestBase
[Test, MoqAutoData]
public async Task Then_Sorted_Apprentices_For_Provider_Are_Return(
OrderedApprenticeshipSearchParameters searchParameters,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext)
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext)
{
//Arrange
searchParameters.FieldName = nameof(Apprenticeship.FirstName);
Expand Down Expand Up @@ -54,7 +54,7 @@ public async Task Then_Sorted_Apprentices_For_Provider_Are_Return(
[Test, MoqAutoData]
public async Task Then_Sorted_Apprentices_For_Employer_Are_Return(
OrderedApprenticeshipSearchParameters searchParameters,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext)
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext)
{
//Arrange
searchParameters.FieldName = nameof(Apprenticeship.FirstName);
Expand Down Expand Up @@ -88,7 +88,7 @@ public async Task Then_Sorted_Apprentices_For_Employer_Are_Return(
[Test, MoqAutoData]
public async Task Then_Sorted_Apprentices_Are_Return_Per_Page(
OrderedApprenticeshipSearchParameters searchParameters,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext)
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext)
{
//Arrange
searchParameters.FieldName = nameof(Apprenticeship.FirstName);
Expand Down Expand Up @@ -117,7 +117,7 @@ public async Task Then_Sorted_Apprentices_Are_Return_Per_Page(
[Test, MoqAutoData]
public async Task Then_Sorted_With_Alerts_Total_Found_Are_Return_With_Page_Data(
OrderedApprenticeshipSearchParameters searchParams,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext)
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext)
{
//Arrange
searchParams.FieldName = nameof(Apprenticeship.FirstName);
Expand All @@ -144,7 +144,7 @@ public async Task Then_Sorted_With_Alerts_Total_Found_Are_Return_With_Page_Data(
[Test, MoqAutoData]
public async Task Then_Apprentices_Are_Sorted_Name(
OrderedApprenticeshipSearchParameters searchParameters,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext)
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext)
{
//Arrange
searchParameters.PageNumber = 0;
Expand Down Expand Up @@ -226,7 +226,7 @@ public async Task Then_Apprentices_Are_Sorted_Name(
[Test, MoqAutoData]
public async Task Then_Apprentices_Are_Sorted_By_Uln(
OrderedApprenticeshipSearchParameters searchParameters,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext)
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext)
{
//Arrange
searchParameters.PageNumber = 0;
Expand Down Expand Up @@ -290,7 +290,7 @@ public async Task Then_Apprentices_Are_Sorted_By_Uln(
[Test, MoqAutoData]
public async Task Then_Apprentices_Are_Sorted_By_Employer_Name(
OrderedApprenticeshipSearchParameters searchParameters,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext)
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext)
{
//Arrange
searchParameters.PageNumber = 0;
Expand Down Expand Up @@ -354,7 +354,7 @@ public async Task Then_Apprentices_Are_Sorted_By_Employer_Name(
[Test, MoqAutoData]
public async Task Then_Apprentices_Are_Sorted_By_Course_Name(
OrderedApprenticeshipSearchParameters searchParameters,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext)
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext)
{
//Arrange
searchParameters.PageNumber = 0;
Expand Down Expand Up @@ -418,7 +418,7 @@ public async Task Then_Apprentices_Are_Sorted_By_Course_Name(
[Test, MoqAutoData]
public async Task Then_Apprentices_Are_Sorted_By_Planned_Start_Date(
OrderedApprenticeshipSearchParameters searchParameters,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext)
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext)
{
//Arrange
searchParameters.PageNumber = 0;
Expand Down Expand Up @@ -485,7 +485,7 @@ public async Task Then_Apprentices_Are_Sorted_By_Planned_Start_Date(
[Test, MoqAutoData]
public async Task Then_Apprentices_Are_Sorted_By_Planned_End_Date(
OrderedApprenticeshipSearchParameters searchParameters,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext)
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext)
{
//Arrange
searchParameters.PageNumber = 0;
Expand Down Expand Up @@ -552,7 +552,7 @@ public async Task Then_Apprentices_Are_Sorted_By_Planned_End_Date(
[Test, MoqAutoData]
public async Task Then_Apprentices_Are_Sorted_By_Apprenticeship_Status(
OrderedApprenticeshipSearchParameters searchParameters,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext)
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext)
{
//Arrange
searchParameters.PageNumber = 0;
Expand Down Expand Up @@ -622,7 +622,7 @@ public async Task Then_Apprentices_Are_Sorted_By_Apprenticeship_Status(
[Test, MoqAutoData]
public async Task Then_Apprentices_Are_Sorted_By_Provider_Name(
OrderedApprenticeshipSearchParameters searchParameters,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext)
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext)
{
//Arrange
searchParameters.PageNumber = 0;
Expand Down Expand Up @@ -692,7 +692,7 @@ public async Task Then_Apprentices_Are_Sorted_By_Provider_Name(
[Test, MoqAutoData]
public async Task Then_Apprentices_Are_First_Sorted_By_Alerts(
OrderedApprenticeshipSearchParameters searchParameters,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext)
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext)
{
//Arrange
searchParameters.PageNumber = 0;
Expand Down Expand Up @@ -761,7 +761,7 @@ public async Task Then_Apprentices_Are_First_Sorted_By_Alerts(
[Test, MoqAutoData]
public async Task Then_Will_Return_Total_Apprenticeships_For_Provider(
OrderedApprenticeshipSearchParameters searchParameters,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext)
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext)
{
searchParameters.ReverseSort = false;
searchParameters.Filters = new ApprenticeshipSearchFilters();
Expand All @@ -788,7 +788,7 @@ public async Task Then_Will_Return_Total_Apprenticeships_For_Provider(
[Test, MoqAutoData]
public async Task Then_Will_Return_Total_Apprenticeships_For_Employer(
OrderedApprenticeshipSearchParameters searchParameters,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext)
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext)
{
//Arrange
searchParameters.FieldName = nameof(Apprenticeship.FirstName);
Expand Down Expand Up @@ -819,7 +819,7 @@ public async Task Then_Will_Return_Total_Apprenticeships_For_Employer(
[Test, MoqAutoData]
public async Task Then_Will_Return_Page_Number_Of_One_If_Only_Page(
OrderedApprenticeshipSearchParameters searchParameters,
[Frozen] Mock<ICommitmentsReadOnlyDbContext> mockContext)
[Frozen] Mock<IProviderCommitmentsDbContext> mockContext)
{
//Arrange
searchParameters.FieldName = nameof(Apprenticeship.FirstName);
Expand Down
Loading

0 comments on commit 133eb2f

Please sign in to comment.