Skip to content

Commit

Permalink
Merge pull request #1477 from SkillsFundingAgency/FAI-1283-FAA-API-Is…
Browse files Browse the repository at this point in the history
…sues

FAI-1283-FAA-API-Issues
  • Loading branch information
SijiOdun committed Jun 21, 2024
2 parents 30452a4 + 5371d69 commit 97aa038
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Linq;
using System;
using System.Linq;
using AutoFixture.NUnit3;
using NUnit.Framework;
using SFA.DAS.Vacancies.Api.Models;
Expand All @@ -22,6 +23,7 @@ public void Then_The_Fields_Are_Mapped(GetVacanciesQueryResult source, int ukprn
actual.Vacancies.Should().BeEquivalentTo(source.Vacancies, options => options.ExcludingMissingMembers()
.Excluding(c => c.EmployerName)
.Excluding(c => c.Ukprn)
.Excluding(item => item.ClosingDate)
.Excluding(c => c.VacancyReference)
);
actual.Total.Should().Be(source.Total);
Expand All @@ -32,7 +34,8 @@ public void Then_The_Fields_Are_Mapped(GetVacanciesQueryResult source, int ukprn
var expectedVacancy =
source.Vacancies.Single(c => c.VacancyReference.Equals(vacancy.VacancyReference.Replace("VAC","")));
vacancy.Location.Lat.Should().Be(expectedVacancy.Location.Lat);
vacancy.Location.Lon.Should().Be(expectedVacancy.Location.Lon);
vacancy.Location.Lon.Should().Be(expectedVacancy.Location.Lon);
vacancy.ClosingDate.Should().Be(expectedVacancy.ClosingDate.AddDays(1).Subtract(TimeSpan.FromSeconds(1)));
}

}
Expand All @@ -59,6 +62,7 @@ public void And_IsEmployerAnonymous_Then_Anon_Values_Used(GetVacanciesQueryResul
.Excluding(item => item.EmployerName)
.Excluding(item => item.CourseTitle)
.Excluding(item => item.CourseLevel)
.Excluding(item => item.ClosingDate)
.Excluding(item => item.Location));
actual.Vacancies.TrueForAll(c => c.IsNationalVacancy).Should().BeTrue();
for (var i = 0; i < actual.Vacancies.Count; i++)
Expand All @@ -70,7 +74,7 @@ public void And_IsEmployerAnonymous_Then_Anon_Values_Used(GetVacanciesQueryResul
actual.Vacancies[i].Course.Route.Should().Be(sourceVacancies[i].Route);
actual.Vacancies[i].Course.LarsCode.Should().Be(sourceVacancies[i].StandardLarsCode);
actual.Vacancies[i].Location.Lat.Should().Be(sourceVacancies[i].Location.Lat);
actual.Vacancies[i].Location.Lon.Should().Be(sourceVacancies[i].Location.Lon);
actual.Vacancies[i].Location.Lon.Should().Be(sourceVacancies[i].Location.Lon);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public void Then_The_Fields_Are_Mapped(GetVacancyQueryResult source, int ukprn)
.Excluding(c=>c.WorkingWeek)
.Excluding(c=>c.Score)
.Excluding(c=>c.IsPositiveAboutDisability)
.Excluding(c => c.ClosingDate)
.Excluding(item => item.Ukprn)
.Excluding(item => item.VacancyReference)
);
Expand All @@ -64,6 +65,7 @@ public void Then_The_Fields_Are_Mapped(GetVacancyQueryResult source, int ukprn)
actual.Wage.WageAmountUpperBound.Should().Be(source.Vacancy.WageAmountUpperBound);
actual.Ukprn.Should().Be(ukprn);
actual.VacancyReference.Should().Be(source.Vacancy.VacancyReference.Replace("VAC", ""));
actual.ClosingDate.Should().Be(source.Vacancy.ClosingDate.AddDays(1).Subtract(TimeSpan.FromSeconds(1)));
}

[Test, AutoData]
Expand All @@ -82,6 +84,7 @@ public void Then_If_Anonymous_Then_Anon_Values_Mapped(GetVacancyQueryResult sour
.Excluding(item => item.CourseLevel)
.Excluding(item => item.Location)
.Excluding(item => item.Ukprn)
.Excluding(item => item.ClosingDate)
);
actual.EmployerName.Should().Be(source.Vacancy.AnonymousEmployerName);
actual.Location.Should().BeNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static implicit operator GetVacanciesListResponseItem(GetVacanciesListIte
{
return new GetVacanciesListResponseItem
{
ClosingDate = source.ClosingDate,
ClosingDate = source.ClosingDate.AddDays(1).Subtract(TimeSpan.FromSeconds(1)),
Description = source.Description,
EmployerName = source.IsEmployerAnonymous ? source.AnonymousEmployerName : source.EmployerName,
HoursPerWeek = source.HoursPerWeek,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static implicit operator GetVacancyResponse(GetVacancyQueryResult source)
}
return new GetVacancyResponse
{
ClosingDate = source.Vacancy.ClosingDate,
ClosingDate = source.Vacancy.ClosingDate.AddDays(1).Subtract(TimeSpan.FromSeconds(1)),
Description = source.Vacancy.Description,
EmployerName = source.Vacancy.IsEmployerAnonymous ? source.Vacancy.AnonymousEmployerName : source.Vacancy.EmployerName,
HoursPerWeek = source.Vacancy.HoursPerWeek,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static implicit operator GetVacancyWageItem(GetVacanciesListItem source)
return new GetVacancyWageItem
{
WageAmount = source.WageAmount,
WageType = (WageType)source.WageType,
WageType = source.WageType == 0 ? WageType.Custom : (WageType)source.WageType,
WageAdditionalInformation = source.WageText,
WorkingWeekDescription = source.WorkingWeek,
WageAmountLowerBound = source.WageAmountLowerBound,
Expand Down

0 comments on commit 97aa038

Please sign in to comment.