diff --git a/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/Configuration/ServiceDefinition.Cloud.csdef b/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/Configuration/ServiceDefinition.Cloud.csdef index 6579c79..ee6cca5 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/Configuration/ServiceDefinition.Cloud.csdef +++ b/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/Configuration/ServiceDefinition.Cloud.csdef @@ -23,8 +23,6 @@ - - diff --git a/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/Configuration/ServiceDefinition.Release.csdef b/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/Configuration/ServiceDefinition.Release.csdef index 45ab968..51a6a0e 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/Configuration/ServiceDefinition.Release.csdef +++ b/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/Configuration/ServiceDefinition.Release.csdef @@ -23,8 +23,6 @@ - - diff --git a/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceConfiguration.Cloud.cscfg b/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceConfiguration.Cloud.cscfg index aae64a9..3bd7c80 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceConfiguration.Cloud.cscfg +++ b/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceConfiguration.Cloud.cscfg @@ -16,8 +16,6 @@ - - diff --git a/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceConfiguration.Local.cscfg b/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceConfiguration.Local.cscfg index 572c97c..a6f118f 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceConfiguration.Local.cscfg +++ b/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceConfiguration.Local.cscfg @@ -16,8 +16,6 @@ - - diff --git a/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceConfiguration.PreProd.cscfg b/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceConfiguration.PreProd.cscfg index 9722d45..fe9fa5f 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceConfiguration.PreProd.cscfg +++ b/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceConfiguration.PreProd.cscfg @@ -16,8 +16,6 @@ - - diff --git a/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceConfiguration.Prod.cscfg b/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceConfiguration.Prod.cscfg index f04b033..de23f3d 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceConfiguration.Prod.cscfg +++ b/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceConfiguration.Prod.cscfg @@ -16,8 +16,6 @@ - - diff --git a/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceConfiguration.Release.cscfg b/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceConfiguration.Release.cscfg index df68a7e..a49d57c 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceConfiguration.Release.cscfg +++ b/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceConfiguration.Release.cscfg @@ -16,8 +16,6 @@ - - diff --git a/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceDefinition.csdef b/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceDefinition.csdef index f77ca84..ee6cca5 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceDefinition.csdef +++ b/src/Sfa.Das.ApprenticeshipInfoService.Api.Azure/ServiceDefinition.csdef @@ -23,8 +23,6 @@ - - diff --git a/src/Sfa.Das.ApprenticeshipInfoService.Api/Web.config b/src/Sfa.Das.ApprenticeshipInfoService.Api/Web.config index e6cfdcd..d5d380d 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.Api/Web.config +++ b/src/Sfa.Das.ApprenticeshipInfoService.Api/Web.config @@ -29,8 +29,6 @@ - - diff --git a/src/Sfa.Das.ApprenticeshipInfoService.Core/Configuration/IConfigurationSettings.cs b/src/Sfa.Das.ApprenticeshipInfoService.Core/Configuration/IConfigurationSettings.cs index d39a9c8..90908c1 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.Core/Configuration/IConfigurationSettings.cs +++ b/src/Sfa.Das.ApprenticeshipInfoService.Core/Configuration/IConfigurationSettings.cs @@ -25,11 +25,7 @@ public interface IConfigurationSettings string ElasticsearchPassword { get; } - List FrameworksExpiredRequired { get; } - - List StandardsExpiredRequired { get; } - - int PageSizeApprenticeshipSummary { get; } + int PageSizeApprenticeshipSummary { get; } string IfaStandardApiUrl { get; } } diff --git a/src/Sfa.Das.ApprenticeshipInfoService.Core/Helpers/ActiveApprenticeshipChecker.cs b/src/Sfa.Das.ApprenticeshipInfoService.Core/Helpers/ActiveApprenticeshipChecker.cs index c9f3026..4a3cbba 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.Core/Helpers/ActiveApprenticeshipChecker.cs +++ b/src/Sfa.Das.ApprenticeshipInfoService.Core/Helpers/ActiveApprenticeshipChecker.cs @@ -7,45 +7,14 @@ namespace Sfa.Das.ApprenticeshipInfoService.Core.Helpers { public class ActiveApprenticeshipChecker : IActiveApprenticeshipChecker { - private readonly IConfigurationSettings _configurationSettings; - - public ActiveApprenticeshipChecker(IConfigurationSettings configurationSettings) - { - _configurationSettings = configurationSettings; - } - - public bool CheckActiveFramework(string frameworkId, DateTime? effectiveFrom, DateTime? effectiveTo) - { - return DateHelper.CheckEffectiveDates(effectiveFrom, effectiveTo) || IsSpecialLapsedFramework(frameworkId); - } - - public bool CheckActiveStandard(string standardId, DateTime? effectiveFrom, DateTime? effectiveTo) - { - return DateHelper.CheckEffectiveDates(effectiveFrom, effectiveTo) || IsSpecialLapsedStandard(standardId); - } - - private bool IsSpecialLapsedFramework(string frameworkId) - { - var lapsedFrameworks = _configurationSettings.FrameworksExpiredRequired; - - return CheckValueIntoList(frameworkId, lapsedFrameworks); - } - - private bool IsSpecialLapsedStandard(string standardId) + public bool IsActiveFramework(DateTime? effectiveFrom, DateTime? effectiveTo) { - var lapsedStandards = _configurationSettings.StandardsExpiredRequired; - - return CheckValueIntoList(standardId, lapsedStandards); + return DateHelper.CheckEffectiveDates(effectiveFrom, effectiveTo); } - private static bool CheckValueIntoList(string apprenticeshipId, List lapsedApprenticeships) + public bool IsActiveStandard(DateTime? effectiveFrom, DateTime? effectiveTo) { - if (lapsedApprenticeships == null || lapsedApprenticeships.Count < 1) - { - return false; - } - - return lapsedApprenticeships.Any(lapsedItem => lapsedItem == apprenticeshipId); + return DateHelper.CheckEffectiveDates(effectiveFrom, effectiveTo); } } } diff --git a/src/Sfa.Das.ApprenticeshipInfoService.Core/Helpers/FundingCapCalculator.cs b/src/Sfa.Das.ApprenticeshipInfoService.Core/Helpers/FundingCapCalculator.cs index 46fd2f4..559f449 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.Core/Helpers/FundingCapCalculator.cs +++ b/src/Sfa.Das.ApprenticeshipInfoService.Core/Helpers/FundingCapCalculator.cs @@ -18,12 +18,12 @@ public FundingCapCalculator(IActiveApprenticeshipChecker activeApprenticeshipChe public int CalculateCurrentFundingBand(StandardSearchResultsItem standard) { - return _activeApprenticeshipChecker.CheckActiveStandard(standard.StandardId, standard.EffectiveFrom, standard.EffectiveTo) ? GetFundingCapFromPeriods(standard.FundingPeriods) : 0; + return _activeApprenticeshipChecker.IsActiveStandard(standard.EffectiveFrom, standard.EffectiveTo) ? GetFundingCapFromPeriods(standard.FundingPeriods) : 0; } public int CalculateCurrentFundingBand(FrameworkSearchResultsItem framework) { - return _activeApprenticeshipChecker.CheckActiveFramework(framework.FrameworkId, framework.EffectiveFrom, framework.EffectiveTo) ? GetFundingCapFromPeriods(framework.FundingPeriods) : 0; + return _activeApprenticeshipChecker.IsActiveFramework(framework.EffectiveFrom, framework.EffectiveTo) ? GetFundingCapFromPeriods(framework.FundingPeriods) : 0; } private int GetFundingCapFromPeriods(List fundingPeriods) diff --git a/src/Sfa.Das.ApprenticeshipInfoService.Core/Helpers/IActiveApprenticeshipChecker.cs b/src/Sfa.Das.ApprenticeshipInfoService.Core/Helpers/IActiveApprenticeshipChecker.cs index 1e00750..9ab3834 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.Core/Helpers/IActiveApprenticeshipChecker.cs +++ b/src/Sfa.Das.ApprenticeshipInfoService.Core/Helpers/IActiveApprenticeshipChecker.cs @@ -4,7 +4,7 @@ namespace Sfa.Das.ApprenticeshipInfoService.Core.Helpers { public interface IActiveApprenticeshipChecker { - bool CheckActiveFramework(string frameworkId, DateTime? effectiveFrom, DateTime? effectiveTo); - bool CheckActiveStandard(string standardId, DateTime? effectiveFrom, DateTime? effectiveTo); + bool IsActiveFramework(DateTime? effectiveFrom, DateTime? effectiveTo); + bool IsActiveStandard(DateTime? effectiveFrom, DateTime? effectiveTo); } } \ No newline at end of file diff --git a/src/Sfa.Das.ApprenticeshipInfoService.Infrastructure/Elasticsearch/ProviderRepository.cs b/src/Sfa.Das.ApprenticeshipInfoService.Infrastructure/Elasticsearch/ProviderRepository.cs index 49e2a5c..61a7316 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.Infrastructure/Elasticsearch/ProviderRepository.cs +++ b/src/Sfa.Das.ApprenticeshipInfoService.Infrastructure/Elasticsearch/ProviderRepository.cs @@ -373,7 +373,7 @@ private IEnumerable GetActiveFrameworksForUkprn(long ukp var frameworks = GetFrameworksByProviderUkprn(ukprn); return frameworks - .Where(x => _activeApprenticeshipChecker.CheckActiveFramework(x.FrameworkId, x.EffectiveFrom, x.EffectiveTo)) + .Where(x => _activeApprenticeshipChecker.IsActiveFramework(x.EffectiveFrom, x.EffectiveTo)) .Select(framework => new ApprenticeshipTraining { Name = framework.PathwayName, @@ -390,7 +390,7 @@ private IEnumerable GetActiveStandardsForUkprn(long ukpr var standards = GetStandardsByProviderUkprn(ukprn); return standards - .Where(x => _activeApprenticeshipChecker.CheckActiveStandard(x.StandardId.ToString(), x.EffectiveFrom, x.EffectiveTo)) + .Where(x => _activeApprenticeshipChecker.IsActiveStandard(x.EffectiveFrom, x.EffectiveTo)) .Select(standard => new ApprenticeshipTraining { Name = standard.Title, diff --git a/src/Sfa.Das.ApprenticeshipInfoService.Infrastructure/Mapping/FrameworkMapping.cs b/src/Sfa.Das.ApprenticeshipInfoService.Infrastructure/Mapping/FrameworkMapping.cs index 9fe1aff..1ae378a 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.Infrastructure/Mapping/FrameworkMapping.cs +++ b/src/Sfa.Das.ApprenticeshipInfoService.Infrastructure/Mapping/FrameworkMapping.cs @@ -48,7 +48,7 @@ public Framework MapToFramework(FrameworkSearchResultsItem document) CombinedQualification = document.CombinedQualification?.OrderBy(x => x), EffectiveFrom = document.EffectiveFrom, EffectiveTo = document.EffectiveTo, - IsActiveFramework = _activeApprenticeshipChecker.CheckActiveFramework(document.FrameworkId, document.EffectiveFrom, document.EffectiveTo) + IsActiveFramework = _activeApprenticeshipChecker.IsActiveFramework(document.EffectiveFrom, document.EffectiveTo) }; return framework; @@ -74,7 +74,7 @@ public FrameworkSummary MapToFrameworkSummary(FrameworkSearchResultsItem documen TypicalLength = new TypicalLength { From = document.Duration, To = document.Duration, Unit = "m" }, EffectiveFrom = document.EffectiveFrom, EffectiveTo = document.EffectiveTo, - IsActiveFramework = _activeApprenticeshipChecker.CheckActiveFramework(document.FrameworkId, document.EffectiveFrom, document.EffectiveTo) + IsActiveFramework = _activeApprenticeshipChecker.IsActiveFramework(document.EffectiveFrom, document.EffectiveTo) }; return framework; diff --git a/src/Sfa.Das.ApprenticeshipInfoService.Infrastructure/Mapping/StandardMapping.cs b/src/Sfa.Das.ApprenticeshipInfoService.Infrastructure/Mapping/StandardMapping.cs index 6ce3c11..25b328c 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.Infrastructure/Mapping/StandardMapping.cs +++ b/src/Sfa.Das.ApprenticeshipInfoService.Infrastructure/Mapping/StandardMapping.cs @@ -45,7 +45,7 @@ public Standard MapToStandard(StandardSearchResultsItem document) StandardSectorCode = document.StandardSectorCode, EffectiveFrom = document.EffectiveFrom, EffectiveTo = document.EffectiveTo, - IsActiveStandard = _activeApprenticeshipChecker.CheckActiveStandard(document.StandardId, document.EffectiveFrom, document.EffectiveTo), + IsActiveStandard = _activeApprenticeshipChecker.IsActiveStandard(document.EffectiveFrom, document.EffectiveTo), LastDateForNewStarts = document.LastDateForNewStarts, RegulatedStandard = document.RegulatedStandard }; @@ -68,7 +68,7 @@ public StandardSummary MapToStandardSummary(StandardSearchResultsItem document) Ssa2 = document.SectorSubjectAreaTier2, EffectiveFrom = document.EffectiveFrom, EffectiveTo = document.EffectiveTo, - IsActiveStandard = _activeApprenticeshipChecker.CheckActiveStandard(document.StandardId, document.EffectiveFrom, document.EffectiveTo), + IsActiveStandard = _activeApprenticeshipChecker.IsActiveStandard(document.EffectiveFrom, document.EffectiveTo), LastDateForNewStarts = document.LastDateForNewStarts, RegulatedStandard = document.RegulatedStandard }; diff --git a/src/Sfa.Das.ApprenticeshipInfoService.Infrastructure/Settings/ApplicationSettings.cs b/src/Sfa.Das.ApprenticeshipInfoService.Infrastructure/Settings/ApplicationSettings.cs index e63907b..d2cf5c6 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.Infrastructure/Settings/ApplicationSettings.cs +++ b/src/Sfa.Das.ApprenticeshipInfoService.Infrastructure/Settings/ApplicationSettings.cs @@ -32,31 +32,7 @@ public sealed class ApplicationSettings : IConfigurationSettings public int PageSizeApprenticeshipSummary => int.Parse( ConfigurationManager.AppSettings["PageSizeApprenticeshipSummary"]); - - public List FrameworksExpiredRequired - { - get - { - return - CloudConfigurationManager.GetSetting("FrameworksExpiredRequired") - ?.Split(',') - .Where(s => s != string.Empty).Select(x => x.Trim()).ToList() - ?? new List(); - } - } - - public List StandardsExpiredRequired - { - get - { - return - CloudConfigurationManager.GetSetting("StandardsExpiredRequired") - ?.Split(',') - .Where(s => s != string.Empty).Select(x => x.Trim()).ToList() - ?? new List(); - } - } - + private IEnumerable GetElasticSearchIps() { var urlStrings = CloudConfigurationManager.GetSetting("ElasticServerUrls").Split(','); diff --git a/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Helpers/ActiveFrameworkCheckerTests.cs b/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Helpers/ActiveFrameworkCheckerTests.cs index de690cb..f175503 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Helpers/ActiveFrameworkCheckerTests.cs +++ b/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Helpers/ActiveFrameworkCheckerTests.cs @@ -10,42 +10,30 @@ namespace Sfa.Das.ApprenticeshipInfoService.UnitTests.Helpers [TestFixture] public class ActiveApprenticeshipCheckerTests { - [TestCase("123", null, null, "x", false, "No dates and no special case, so this should be false")] - [TestCase("123", null, null, "123", true, "No dates and special case, so this should be true")] - [TestCase("123", "2017-11-26", null, "x", true, "Effective from in past, so should be true")] - [TestCase("123", "2017-11-24", "2017-11-26", "x", false, "Effective from in past and effective to in past, so should be false")] - [TestCase("123", "2017-11-24", "2017-11-26", "123", true, "Effective from in past and effective to in past + special case, so should be true")] - [TestCase("123", "2040-01-01", null, null, false, "Effective from in future and no special case, so should be false")] - [TestCase("123", "2040-01-01", null, "123", true, "Effective from in future and special case, so should be true")] - [TestCase("123", null, "2040-01-01", null, false, "Effective from absent and effective to in future and no special case, so should be false")] + [TestCase(null, null, false, "No dates, so this should be false")] + [TestCase("2017-11-26", null, true, "Effective from in past, so should be true")] + [TestCase("2017-11-24", "2017-11-26", false, "Effective from in past and effective to in past, so should be false")] + [TestCase("2040-01-01", null, false, "Effective from in future, so should be false")] + [TestCase(null, "2040-01-01", false, "Effective from absent and effective to in future, so should be false")] - public void ShouldCheckActiveFrameworkScenarios(string frameworkId, DateTime? effectiveFrom, DateTime? effectiveTo, string frameworkExpiredRequired, bool expectedResult, string message) + public void ShouldCheckActiveFrameworkScenarios(DateTime? effectiveFrom, DateTime? effectiveTo, bool expectedResult, string message) { - var mockConfigSettings = new Mock(); - mockConfigSettings.Setup(x => x.FrameworksExpiredRequired).Returns(new List { frameworkExpiredRequired }); - - var activeFrameworkChecker = new ActiveApprenticeshipChecker(mockConfigSettings.Object); - var res = activeFrameworkChecker.CheckActiveFramework(frameworkId, effectiveFrom, effectiveTo); + var activeFrameworkChecker = new ActiveApprenticeshipChecker(); + var res = activeFrameworkChecker.IsActiveFramework(effectiveFrom, effectiveTo); Assert.AreEqual(expectedResult, res, message); } - [TestCase("123", null, null, "x", false, "No dates and no special case, so this should be false")] - [TestCase("123", null, null, "123", true, "No dates and special case, so this should be true")] - [TestCase("123", "2017-11-26", null, "x", true, "Effective from in past, so should be true")] - [TestCase("123", "2017-11-24", "2017-11-26", "x", false, "Effective from in past and effective to in past, so should be false")] - [TestCase("123", "2017-11-24", "2017-11-26", "123", true, "Effective from in past and effective to in past + special case, so should be true")] - [TestCase("123", "2040-01-01", null, null, false, "Effective from in future and no special case, so should be false")] - [TestCase("123", "2040-01-01", null, "123", true, "Effective from in future and special case, so should be true")] - [TestCase("123", null, "2040-01-01", null, false, "Effective from absent and effective to in future and no special case, so should be false")] + [TestCase(null, null, false, "No dates, so this should be false")] + [TestCase("2017-11-26", null, true, "Effective from in past, so should be true")] + [TestCase("2017-11-24", "2017-11-26", false, "Effective from in past and effective to in past, so should be false")] + [TestCase("2040-01-01", null, false, "Effective from in future, so should be false")] + [TestCase(null, "2040-01-01", false, "Effective from absent and effective to in future, so should be false")] - public void ShouldCheckActiveStandardScenarios(string standardId, DateTime? effectiveFrom, DateTime? effectiveTo, string standardExpiredRequired, bool expectedResult, string message) + public void ShouldCheckActiveStandardScenarios(DateTime? effectiveFrom, DateTime? effectiveTo, bool expectedResult, string message) { - var mockConfigSettings = new Mock(); - mockConfigSettings.Setup(x => x.StandardsExpiredRequired).Returns(new List { standardExpiredRequired }); - - var activeFrameworkChecker = new ActiveApprenticeshipChecker(mockConfigSettings.Object); - var res = activeFrameworkChecker.CheckActiveStandard(standardId, effectiveFrom, effectiveTo); + var activeFrameworkChecker = new ActiveApprenticeshipChecker(); + var res = activeFrameworkChecker.IsActiveStandard(effectiveFrom, effectiveTo); Assert.AreEqual(expectedResult, res, message); } diff --git a/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Helpers/FundingCapCalculatorTests.cs b/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Helpers/FundingCapCalculatorTests.cs index 72da8c9..12c6bbe 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Helpers/FundingCapCalculatorTests.cs +++ b/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Helpers/FundingCapCalculatorTests.cs @@ -19,10 +19,10 @@ public void Init() _mockApprenticeshipChecker = new Mock(); _mockApprenticeshipChecker - .Setup(x => x.CheckActiveStandard(It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(x => x.IsActiveStandard(It.IsAny(), It.IsAny())) .Returns(true); _mockApprenticeshipChecker - .Setup(x => x.CheckActiveFramework(It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(x => x.IsActiveFramework(It.IsAny(), It.IsAny())) .Returns(true); } @@ -51,10 +51,10 @@ public void ShouldReturnZeroIfFundingPeriodsAreNull() public void ShouldReturnZeroIfApprenticeshipIsNotActive() { _mockApprenticeshipChecker - .Setup(x => x.CheckActiveStandard(It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(x => x.IsActiveStandard(It.IsAny(), It.IsAny())) .Returns(false); _mockApprenticeshipChecker - .Setup(x => x.CheckActiveFramework(It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(x => x.IsActiveFramework(It.IsAny(), It.IsAny())) .Returns(false); var sut = new FundingCapCalculator(_mockApprenticeshipChecker.Object); diff --git a/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Infrastructure/ApplicationSettingsTests.cs b/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Infrastructure/ApplicationSettingsTests.cs deleted file mode 100644 index e857533..0000000 --- a/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Infrastructure/ApplicationSettingsTests.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using NUnit.Framework; -using Sfa.Das.ApprenticeshipInfoService.Infrastructure.Settings; - -namespace Sfa.Das.ApprenticeshipInfoService.UnitTests.Infrastructure -{ - [TestFixture] - public class ApplicationSettingsTests - { - [Test] - public void TestFrameworkExpiredRequiredHandlesDetailsCorrectly() - { - ConfigurationManager.AppSettings["FrameworksExpiredRequired"] = "123 , 456 , 768 "; - - var frameworksExpired = new ApplicationSettings().FrameworksExpiredRequired; - - var expectedList = new List { "123", "456", "768" }; - - Assert.AreEqual(expectedList, frameworksExpired); - } - } -} diff --git a/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Infrastructure/Mapping/FrameworkMappingTests.cs b/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Infrastructure/Mapping/FrameworkMappingTests.cs index cd63f76..1ecf5b4 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Infrastructure/Mapping/FrameworkMappingTests.cs +++ b/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Infrastructure/Mapping/FrameworkMappingTests.cs @@ -21,13 +21,12 @@ public class FrameworkMappingTests [SetUp] public void Init() { - _mockConfigurationSettings = new Mock(); _mockFundingCapCalculator = new Mock(); _mockFundingCapCalculator.Setup(x => x.CalculateCurrentFundingBand(It.IsAny())) .Returns(0); _mockFundingCapCalculator.Setup(x => x.CalculateCurrentFundingBand(It.IsAny())) .Returns(0); - _activeApprenticeshipChecker = new ActiveApprenticeshipChecker(_mockConfigurationSettings.Object); + _activeApprenticeshipChecker = new ActiveApprenticeshipChecker(); _sut = new FrameworkMapping(_activeApprenticeshipChecker, _mockFundingCapCalculator.Object); } diff --git a/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Repositories/ProviderRepositoryTests.cs b/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Repositories/ProviderRepositoryTests.cs index 5970c81..abd4673 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Repositories/ProviderRepositoryTests.cs +++ b/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Repositories/ProviderRepositoryTests.cs @@ -441,16 +441,16 @@ var providerStandardZebraWranglerShouldBeCutOffByProviderApprenticeshipTrainingM searchResponseForFrameworks.Setup(x => x.Documents).Returns(frameworks); _mockActiveFrameworkChecker - .Setup(x => x.CheckActiveFramework(It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(x => x.IsActiveFramework(It.IsAny(), It.IsAny())) .Returns(true); _mockActiveFrameworkChecker - .Setup(x => x.CheckActiveFramework("234-3-2", It.IsAny(), It.IsAny())) + .Setup(x => x.IsActiveFramework(It.IsAny(), DateTime.Today.AddDays(-2))) .Returns(false); _mockActiveFrameworkChecker - .Setup(x => x.CheckActiveStandard(It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(x => x.IsActiveStandard(It.IsAny(), It.IsAny())) .Returns(true); _mockActiveFrameworkChecker - .Setup(x => x.CheckActiveStandard(It.IsAny(), null, It.IsAny())) + .Setup(x => x.IsActiveStandard(null, It.IsAny())) .Returns(false); _elasticClient.Setup(x => x.Search(It.IsAny, ISearchRequest>>(), It.IsAny())).Returns(searchResponseForDtos.Object); @@ -554,13 +554,13 @@ public void ShouldReturnActiveListOfProviderApprenticeshipsForUkprnInExpectedOrd searchResponseForFrameworks.Setup(x => x.Documents).Returns(frameworks); _mockActiveFrameworkChecker - .Setup(x => x.CheckActiveFramework(It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(x => x.IsActiveFramework(It.IsAny(), It.IsAny())) .Returns(true); _mockActiveFrameworkChecker - .Setup(x => x.CheckActiveStandard(It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(x => x.IsActiveStandard(It.IsAny(), It.IsAny())) .Returns(true); _mockActiveFrameworkChecker - .Setup(x => x.CheckActiveStandard(It.IsAny(), null, It.IsAny())) + .Setup(x => x.IsActiveStandard(null, It.IsAny())) .Returns(false); _elasticClient.Setup(x => x.Search(It.IsAny, ISearchRequest>>(), It.IsAny())).Returns(searchResponseForDtos.Object); diff --git a/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Sfa.Das.ApprenticeshipInfoService.UnitTests.csproj b/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Sfa.Das.ApprenticeshipInfoService.UnitTests.csproj index ee6fc2a..9e868e0 100644 --- a/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Sfa.Das.ApprenticeshipInfoService.UnitTests.csproj +++ b/src/Sfa.Das.ApprenticeshipInfoService.UnitTests/Sfa.Das.ApprenticeshipInfoService.UnitTests.csproj @@ -118,7 +118,6 @@ -