Skip to content

Commit

Permalink
Updated Testing logic and packages (#628)
Browse files Browse the repository at this point in the history
* Updated Testing logic and packages
  • Loading branch information
FrostyApeOne authored Oct 16, 2024
1 parent a9625e8 commit 69f367a
Show file tree
Hide file tree
Showing 9 changed files with 254 additions and 241 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/build-and-push-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ name: Build and Push NuGet Package

on:
push:
branches:
- release/*
paths:
- 'Dfe.PersonsApi.Client*/**'
tags:
- 'production-*'

env:
DOTNET_VERSION: '8.0.x'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public AcademyWithGovernanceProfile()
{
CreateMap<AcademyGovernanceQueryModel, AcademyGovernance>()
.ForMember(dest => dest.Id, opt => opt.MapFrom(src => (int)src.EducationEstablishmentGovernance.SK))
.ForMember(dest => dest.UKPRN, opt => opt.MapFrom(src => src.Establishment.UKPRN))
.ForMember(dest => dest.URN, opt => opt.MapFrom(src => src.Establishment.URN))
.ForMember(dest => dest.FirstName, opt => opt.MapFrom(src => src.EducationEstablishmentGovernance.Forename1))
.ForMember(dest => dest.LastName, opt => opt.MapFrom(src => src.EducationEstablishmentGovernance.Surname))
.ForMember(dest => dest.Email, opt => opt.MapFrom(src => src.EducationEstablishmentGovernance.Email))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Dfe.Academies.PersonsApi.Tests.Integration.Controllers
public class ConstituenciesControllerTests
{
[Theory]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization<Startup>))]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization))]
public async Task GetMemberOfParliamentByConstituencyAsync_ShouldReturnMp_WhenConstituencyExists(
CustomWebApplicationDbContextFactory<Startup> factory,
IConstituenciesClient constituenciesClient)
Expand All @@ -38,7 +38,7 @@ await dbContext.Constituencies
}

[Theory]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization<Startup>))]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization))]
public async Task GetMemberOfParliamentByConstituencyAsync_ShouldReturnNotFound_WhenConstituencyDoesNotExist(
CustomWebApplicationDbContextFactory<Startup> factory,
IConstituenciesClient constituenciesClient)
Expand All @@ -56,7 +56,7 @@ public async Task GetMemberOfParliamentByConstituencyAsync_ShouldReturnNotFound_
}

[Theory]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization<Startup>))]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization))]
public async Task GetMemberOfParliamentByConstituenciesAsync_ShouldReturnMps_WhenConstituenciesExists(
CustomWebApplicationDbContextFactory<Startup> factory,
IConstituenciesClient constituenciesClient)
Expand All @@ -82,7 +82,7 @@ await dbcontext.Constituencies.Where(x => x.ConstituencyName == "Test Constituen
}

[Theory]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization<Startup>))]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization))]
public async Task GetMemberOfParliamentByConstituenciesAsync_ShouldReturnEmpty_WhenConstituenciesDontExists(
CustomWebApplicationDbContextFactory<Startup> factory,
IConstituenciesClient constituenciesClient)
Expand All @@ -100,7 +100,7 @@ public async Task GetMemberOfParliamentByConstituenciesAsync_ShouldReturnEmpty_W
}

[Theory]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization<Startup>))]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization))]
public async Task GetMemberOfParliamentByConstituenciesAsync_ShouldThrowAnException_WhenConstituenciesNotProvided(
CustomWebApplicationDbContextFactory<Startup> factory,
IConstituenciesClient constituenciesClient)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Dfe.Academies.PersonsApi.Tests.Integration.Controllers
public class EstablishmentsControllerTests
{
[Theory]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization<Startup>))]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization))]
public async Task GetAllPersonsAssociatedWithAcademyAsync_ShouldReturnPeople_WhenAcademyExists(
CustomWebApplicationDbContextFactory<Startup> factory,
IEstablishmentsClient establishmentsClient)
Expand All @@ -39,7 +39,7 @@ await dbContext.Establishments.Where(x => x.SK == 1)
}

[Theory]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization<Startup>))]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization))]
public async Task GetAllPersonsAssociatedWithAcademyAsync_ShouldReturnEmptyList_WhenAcademyExistWithNoPeople(
CustomWebApplicationDbContextFactory<Startup> factory,
IEstablishmentsClient establishmentsClient)
Expand All @@ -61,7 +61,7 @@ await dbContext.Establishments.Where(x => x.SK == 2)
}

[Theory]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization<Startup>))]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization))]
public async Task GetAllPersonsAssociatedWithAcademyAsync_ShouldThrowAnException_WhenAcademyDoesntExists(
CustomWebApplicationDbContextFactory<Startup> factory,
IEstablishmentsClient establishmentsClient)
Expand All @@ -77,7 +77,7 @@ public async Task GetAllPersonsAssociatedWithAcademyAsync_ShouldThrowAnException
}

[Theory]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization<Startup>))]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization))]
public async Task GetGetMemberOfParliamentBySchoolUrnAsync_ShouldReturnMP_WhenSchoolExists(
CustomWebApplicationDbContextFactory<Startup> factory,
IEstablishmentsClient establishmentsClient)
Expand Down Expand Up @@ -106,7 +106,7 @@ await mopDbContext.Constituencies.Where(x => x.ConstituencyName == "Test Constit
}

[Theory]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization<Startup>))]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization))]
public async Task GetGetMemberOfParliamentBySchoolUrnAsync_ShouldReturnNull_WhenSchoolDoesntExists(
CustomWebApplicationDbContextFactory<Startup> factory,
IEstablishmentsClient establishmentsClient)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Dfe.Academies.PersonsApi.Tests.Integration.Controllers
public class TrustsControllerTests
{
[Theory]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization<Startup>))]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization))]
public async Task GetAllPersonsAssociatedWithTrustAsync_ShouldReturnPeople_WhenTrustExists(
CustomWebApplicationDbContextFactory<Startup> factory,
ITrustsClient trustsClient)
Expand All @@ -32,7 +32,7 @@ public async Task GetAllPersonsAssociatedWithTrustAsync_ShouldReturnPeople_WhenT
}

[Theory]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization<Startup>))]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization))]
public async Task GetAllPersonsAssociatedWithTrustAsync_ShouldReturnEmptyList_WhenTrustExistWithNoPeople(
CustomWebApplicationDbContextFactory<Startup> factory,
ITrustsClient trustsClient)
Expand All @@ -49,7 +49,7 @@ public async Task GetAllPersonsAssociatedWithTrustAsync_ShouldReturnEmptyList_Wh
}

[Theory]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization<Startup>))]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization))]
public async Task GetAllPersonsAssociatedWithTrustAsync_ShouldThrowAnException_WhenTrustDoesntExists(
CustomWebApplicationDbContextFactory<Startup> factory,
ITrustsClient trustsClient)
Expand All @@ -65,7 +65,7 @@ public async Task GetAllPersonsAssociatedWithTrustAsync_ShouldThrowAnException_W
}

[Theory]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization<Startup>))]
[CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization))]
public async Task GetAllPersonsAssociatedWithTrustAsync_ShouldThrowAnException_WhenInvalidIdProvided(
CustomWebApplicationDbContextFactory<Startup> factory,
ITrustsClient trustsClient)
Expand Down
Loading

0 comments on commit 69f367a

Please sign in to comment.