Skip to content

Commit

Permalink
CON-1654-Resolved PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
VasanthaKasirajan3008 committed Apr 17, 2020
1 parent 5804ad7 commit 0bc23e7
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void Arrange()
_mockAccountLegalEntityPublicHashingService.Setup(m => m.DecodeValue(It.IsAny<string>())).Returns(_accountLegelEntityId);

_mockEmployerAgreementRepository = new Mock<IEmployerAgreementRepository>();
_mockEmployerAgreementRepository.Setup(m => m.GetOrganisationAgreement(It.IsAny<long>())).ReturnsAsync(new AccountLegalEntity {
_mockEmployerAgreementRepository.Setup(m => m.GetAccountLegalEntityAgreements(It.IsAny<long>())).ReturnsAsync(new AccountLegalEntity {
LegalEntity = new LegalEntity { Id=1, Source= OrganisationType.CompaniesHouse } ,
Agreements = new List<EmployerAgreement>() { new EmployerAgreement { SignedDate = DateTime.UtcNow, } }});

Expand Down Expand Up @@ -75,7 +75,7 @@ public override async Task ThenIfTheMessageIsValidTheRepositoryIsCalled()
await RequestHandler.Handle(Query);

//Assert
_mockEmployerAgreementRepository.Verify(x => x.GetOrganisationAgreement(It.IsAny<long>()), Times.Once);
_mockEmployerAgreementRepository.Verify(x => x.GetAccountLegalEntityAgreements(It.IsAny<long>()), Times.Once);
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public AgreementMappings()
.ConvertUsing(new AgreementInfoConverter());

CreateMap<EmployerAgreementDto, OrganisationAgreementViewModel>()
.ForMember(dest => dest.SignedDateText, opt => opt.MapFrom(src => src.SignedDate.HasValue ? src.SignedDate.Value.ToString("dd MMMM yyyy") : ""))
.ForMember(dest => dest.SignedDateText, opt => opt.Ignore())
.ForMember(dest => dest.AccountLegalEntityPublicHashedId, opts => opts.Ignore())
.ForMember(dest => dest.GetAgreementTabListId, opts => opts.Ignore())
.ForMember(dest => dest.GetAgreementTabPanelId, opts => opts.Ignore())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,7 @@ public virtual async Task<OrchestratorResponse<ICollection<OrganisationAgreement
{
return new OrchestratorResponse<ICollection<OrganisationAgreementViewModel>>
{
Status = HttpStatusCode.BadRequest,
Data = new List<OrganisationAgreementViewModel>(),
Status = HttpStatusCode.BadRequest,
Exception = ex
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class OrganisationAgreementViewModel
public string HashedAgreementId { get; set; }

public string AccountLegalEntityPublicHashedId => AccountLegalEntity.PublicHashedId;
public string SignedDateText { get; set; }
public string SignedDateText => SignedDate.HasValue ? SignedDate.Value.ToString("dd MMMM yyyy") : "";
public string GetAgreementTabListId => $"#v{Template.VersionNumber}-agreement";
public string GetAgreementTabPanelId => $"#v{Template.VersionNumber}-agreement";
public string GetAgreementTabCssClass => Template.VersionNumber == 0 ? "govuk-tabs__list-item" : "govuk-tabs__list-item govuk-tabs__list-item--selected";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
@{Layout = "~/Views/Shared/_Layout_CDN.cshtml"; }
@using SFA.DAS.EmployerAccounts.Web.Helpers
@using SFA.DAS.EmployerAccounts.Web.Helpers
@model OrchestratorResponse<ICollection<OrganisationAgreementViewModel>>
@{

@{
Layout = "~/Views/Shared/_Layout_CDN.cshtml";
ViewBag.PageID = "organisations-agreements-details";
ViewBag.Title = "ViewAllAgreements";
ViewBag.Section = "organisations";
ViewBag.ZenDeskLabel = "eas-your-esfa-agreement";
}

@{
ViewBag.GaData.Vpv = "/accounts/agreements/view-your-agreement/agreement-details";
}

@{Layout = "~/Views/Shared/_Layout_CDN.cshtml"; }

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public async Task SetAccountLegalEntityAgreementDetails(long accountLegalEntityI
await _db.Value.SaveChangesAsync();
}

public async Task<AccountLegalEntity> GetOrganisationAgreement(long accountLegalEntityId)
public async Task<AccountLegalEntity> GetAccountLegalEntityAgreements(long accountLegalEntityId)
{
var accountLegalEntity = await _db.Value.AccountLegalEntities
.Where(ale => ale.Id == accountLegalEntityId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ public interface IEmployerAgreementRepository
Task<IEnumerable<EmployerAgreement>> GetAccountAgreements(long accountId);
Task<EmployerAgreementStatus?> GetEmployerAgreementStatus(long agreementId);
Task SetAccountLegalEntityAgreementDetails(long accountLegalEntityId, long? pendingAgreementId, int? pendingAgreementVersion, long? signedAgreementId, int? signedAgreementVersion);
Task<AccountLegalEntity> GetOrganisationAgreement(long accountLegalEntityId);
Task<AccountLegalEntity> GetAccountLegalEntityAgreements(long accountLegalEntityId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public async Task<GetOrganisationAgreementsResponse> Handle(GetOrganisationAgree

var accountLegalEntityId = _accountLegalEntityPublicHashingService.DecodeValue(message.AccountLegalEntityHashedId);

var accountLegalEntity = await _employerAgreementRepository.GetOrganisationAgreement(accountLegalEntityId);
var accountLegalEntity = await _employerAgreementRepository.GetAccountLegalEntityAgreements(accountLegalEntityId);
if (accountLegalEntity == null) return new GetOrganisationAgreementsResponse();

var organisationLookupByIdPossible = await _referenceDataService.IsIdentifiableOrganisationType(accountLegalEntity.LegalEntity.Source);
Expand Down

0 comments on commit 0bc23e7

Please sign in to comment.