Skip to content

Commit

Permalink
- added more unit testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduardo Herrera authored and Eduardo Herrera committed Nov 3, 2023
1 parent e799780 commit 0641f4e
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void SearchAgreement_Project()
}

[Fact]
public void SearchAgreement_Team()
public void SearchAgreement_Team_Person()
{
// Arrange
var helper = new TestHelper();
Expand All @@ -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<PimsAcquisitionFileTeam>() { new PimsAcquisitionFileTeam() { OrganizationId = 100 } };
var agreement = new PimsAgreement() { AcquisitionFile = acqFile, AgreementTypeCodeNavigation = new PimsAgreementType() { AgreementTypeCode = "test" } };
var filter = new AcquisitionReportFilterModel() { AcquisitionTeamOrganizations = new List<long> { 100 } };

helper.CreatePimsContext(user, true).AddAndSaveChanges(agreement);

var repository = helper.CreateRepository<AgreementRepository>(user);

// Act
var result = repository.SearchAgreements(filter);

// Assert
result.Should().HaveCount(1);
}

[Fact]
public void SearchAgreement_TeamAndProject()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public void SearchCompensationRequisitionFinancials_AlternateProject()
}

[Fact]
public void SearchCompensationRequisitionFinancials_Team()
public void SearchCompensationRequisitionFinancials_Team_Person()
{
// Arrange
var acqFile = EntityHelper.CreateAcquisitionFile();
Expand All @@ -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<PimsAcquisitionFileTeam>() { 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<long> { 100 } };
var result = repository.SearchCompensationRequisitionFinancials(filter);

// Assert
result.Should().HaveCount(1);
}
}
}

0 comments on commit 0641f4e

Please sign in to comment.