diff --git a/source/backend/tests/unit/dal/Repositories/AgreementRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/AgreementRepositoryTest.cs index 0e040b999a..1696526035 100644 --- a/source/backend/tests/unit/dal/Repositories/AgreementRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/AgreementRepositoryTest.cs @@ -49,7 +49,7 @@ public void SearchAgreement_Project() } [Fact] - public void SearchAgreement_Team() + public void SearchAgreement_Team_Person() { // Arrange var helper = new TestHelper(); @@ -70,6 +70,28 @@ public void SearchAgreement_Team() result.Should().HaveCount(1); } + [Fact] + public void SearchAgreement_Team_Organization() + { + // Arrange + var helper = new TestHelper(); + var user = PrincipalHelper.CreateForPermission(Permissions.AcquisitionFileAdd); + var acqFile = EntityHelper.CreateAcquisitionFile(); + acqFile.PimsAcquisitionFileTeams = new List() { new PimsAcquisitionFileTeam() { OrganizationId = 100 } }; + var agreement = new PimsAgreement() { AcquisitionFile = acqFile, AgreementTypeCodeNavigation = new PimsAgreementType() { AgreementTypeCode = "test" } }; + var filter = new AcquisitionReportFilterModel() { AcquisitionTeamOrganizations = new List { 100 } }; + + helper.CreatePimsContext(user, true).AddAndSaveChanges(agreement); + + var repository = helper.CreateRepository(user); + + // Act + var result = repository.SearchAgreements(filter); + + // Assert + result.Should().HaveCount(1); + } + [Fact] public void SearchAgreement_TeamAndProject() { diff --git a/source/backend/tests/unit/dal/Repositories/CompReqFinancialRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/CompReqFinancialRepositoryTest.cs index 5d09e8b711..796af0b625 100644 --- a/source/backend/tests/unit/dal/Repositories/CompReqFinancialRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/CompReqFinancialRepositoryTest.cs @@ -158,7 +158,7 @@ public void SearchCompensationRequisitionFinancials_AlternateProject() } [Fact] - public void SearchCompensationRequisitionFinancials_Team() + public void SearchCompensationRequisitionFinancials_Team_Person() { // Arrange var acqFile = EntityHelper.CreateAcquisitionFile(); @@ -184,5 +184,33 @@ public void SearchCompensationRequisitionFinancials_Team() // Assert result.Should().HaveCount(1); } + + [Fact] + public void SearchCompensationRequisitionFinancials_Team_Organization() + { + // Arrange + var acqFile = EntityHelper.CreateAcquisitionFile(); + acqFile.PimsAcquisitionFileTeams = new List() { new PimsAcquisitionFileTeam() { OrganizationId = 100 } }; + var financial = new PimsCompReqFinancial + { + FinancialActivityCode = new PimsFinancialActivityCode { Code = "test" }, + CompensationRequisitionId = 1, + CompensationRequisition = new PimsCompensationRequisition + { + AcquisitionFileId = acqFile.Internal_Id, + AcquisitionFile = acqFile, + }, + }; + + var repository = this.CreateWithPermissions(Permissions.AcquisitionFileAdd); + this._helper.AddAndSaveChanges(financial); + + // Act + var filter = new AcquisitionReportFilterModel() { AcquisitionTeamOrganizations = new List { 100 } }; + var result = repository.SearchCompensationRequisitionFinancials(filter); + + // Assert + result.Should().HaveCount(1); + } } }