-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #855 from SkillsFundingAgency/CON-956-Store-Hashed…
…AccountLegalEntityId CON-956 populated account legal entity hash id in employer edit info …
- Loading branch information
Showing
4 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...Vacancies.Client/Infrastructure/Mappings/LegalEntityMapperTests/WhenMappingLegalEntity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using SFA.DAS.EAS.Account.Api.Types; | ||
using Xunit; | ||
using AutoFixture; | ||
using FluentAssertions; | ||
using Esfa.Recruit.Vacancies.Client.Infrastructure.Services.EmployerAccount; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace UnitTests.Recruit.Vacancies.Client.Infrastructure.Mappings.LegalEntityMapperTests | ||
{ | ||
public class WhenMappingLegalEntity | ||
{ | ||
[Fact] | ||
public void ThenReturnsCorrectlyPolulatedLegalEntity() | ||
{ | ||
// Arrange | ||
var fixture = new Fixture(); | ||
var expected = fixture | ||
.Build<LegalEntityViewModel>() | ||
.With(x => x.Address, "Cheylesmore House, 5 Quinton Rd, Coventry, CV1 2WT") | ||
.With( x => x.Agreements, new List<AgreementViewModel>()) | ||
.Create(); | ||
|
||
// Act | ||
var actual = LegalEntityMapper.MapFromAccountApiLegalEntity(expected); | ||
|
||
// Assert | ||
actual.LegalEntityId.Should().Be(expected.LegalEntityId); | ||
actual.AccountLegalEntityPublicHashedId.Should().Be(expected.AccountLegalEntityPublicHashedId); | ||
actual.Name.Should().Be(expected.Name); | ||
actual.HasLegalEntityAgreement.Should().BeFalse(); | ||
} | ||
|
||
[Fact] | ||
public void ThenSetsHasLegalEntityAgreementToTrue() | ||
{ | ||
// Arrange | ||
var fixture = new Fixture(); | ||
var agreementViewModel = fixture | ||
.Build<AgreementViewModel>() | ||
.With(x => x.Status, EmployerAgreementStatus.Signed) | ||
.Create(); | ||
var expected = fixture | ||
.Build<LegalEntityViewModel>() | ||
.With(x => x.Address, "Cheylesmore House, 5 Quinton Rd, Coventry, CV1 2WT") | ||
.With( x => x.Agreements, new List<AgreementViewModel>{ agreementViewModel }) | ||
.Create(); | ||
|
||
// Act | ||
var actual = LegalEntityMapper.MapFromAccountApiLegalEntity(expected); | ||
|
||
// Assert | ||
actual.HasLegalEntityAgreement.Should().BeTrue(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters