From 6a51fb36472c9e79e288861a41a0523fde785b7d Mon Sep 17 00:00:00 2001 From: Daniel Ashton Date: Wed, 30 Dec 2020 11:45:20 +0000 Subject: [PATCH] FAT2-295 - Remove autofixture dependency --- .../SFA.DAS.EmployerFinance.UnitTests.csproj | 1 - .../WhenGettingApprenticeshipInfo.cs | 53 +++++++++++++++---- .../WhenIGetAProvider.cs | 8 +-- 3 files changed, 49 insertions(+), 13 deletions(-) diff --git a/src/SFA.DAS.EmployerFinance.UnitTests/SFA.DAS.EmployerFinance.UnitTests.csproj b/src/SFA.DAS.EmployerFinance.UnitTests/SFA.DAS.EmployerFinance.UnitTests.csproj index 30da581191..0b2f1bf005 100644 --- a/src/SFA.DAS.EmployerFinance.UnitTests/SFA.DAS.EmployerFinance.UnitTests.csproj +++ b/src/SFA.DAS.EmployerFinance.UnitTests/SFA.DAS.EmployerFinance.UnitTests.csproj @@ -12,7 +12,6 @@ - diff --git a/src/SFA.DAS.EmployerFinance.UnitTests/Services/ApprenticeshipInfoServiceWrapperTests/WhenGettingApprenticeshipInfo.cs b/src/SFA.DAS.EmployerFinance.UnitTests/Services/ApprenticeshipInfoServiceWrapperTests/WhenGettingApprenticeshipInfo.cs index 2fde8bd2a4..95656f8d79 100644 --- a/src/SFA.DAS.EmployerFinance.UnitTests/Services/ApprenticeshipInfoServiceWrapperTests/WhenGettingApprenticeshipInfo.cs +++ b/src/SFA.DAS.EmployerFinance.UnitTests/Services/ApprenticeshipInfoServiceWrapperTests/WhenGettingApprenticeshipInfo.cs @@ -1,6 +1,6 @@ +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using AutoFixture; using FluentAssertions; using Moq; using NUnit.Framework; @@ -34,8 +34,16 @@ public async Task Then_The_Standards_Are_Retrieved_From_The_Api_And_Added_To_Cac { //Arrange StandardsView returnData = null; - var fixture = new Fixture(); - var apiResponse = fixture.Create(); + var apiResponse = new GetStandardsResponse + { + Standards = new List + { + new StandardResponseItem + { + Id = 1 + } + } + }; _apiClient.Setup(x => x.Get(It.IsAny())) .ReturnsAsync(apiResponse); _cache.Setup(x => x.Exists("Standards")).Returns(false); @@ -62,8 +70,16 @@ public async Task Then_The_Standards_Are_Retrieved_From_The_Api_And_Added_To_Cac public async Task Then_Standards_Retrieved_From_Cache_If_Cached() { //Arrange - var fixture = new Fixture(); - var cacheData = fixture.Create(); + var cacheData = new StandardsView + { + Standards = new List + { + new Standard + { + Code = 1 + } + } + }; _cache.Setup(x => x.Exists("Standards")).Returns(true); _cache.Setup(x => x.Get("Standards")).Returns(cacheData); @@ -79,8 +95,19 @@ public async Task Then_Standards_Retrieved_From_Cache_If_Cached() public async Task Then_The_Frameworks_Are_Retrieved_From_The_Api_And_Added_To_Cached() { //Arrange - var fixture = new Fixture(); - var apiResponse = fixture.Create(); + var apiResponse = new GetFrameworksResponse + { + Frameworks = new List + { + new FrameworkResponseItem + { + Id = "123", + FrameworkName = "test", + PathwayName = "test", + Title = "test" + } + } + }; FrameworksView returnData = null; _apiClient.Setup(x => x.Get(It.IsAny())) @@ -107,8 +134,16 @@ public async Task Then_The_Frameworks_Are_Retrieved_From_The_Api_And_Added_To_Ca public async Task Then_Frameworks_Retrieved_From_Cache_If_Cached() { //Arrange - var fixture = new Fixture(); - var cacheData = fixture.Create(); + var cacheData = new FrameworksView + { + Frameworks = new List + { + new Framework + { + Id = "123" + } + } + }; _cache.Setup(x => x.Exists("Frameworks")).Returns(true); _cache.Setup(x => x.Get("Frameworks")).Returns(cacheData); diff --git a/src/SFA.DAS.EmployerFinance.UnitTests/Services/ProviderServiceTests/ProviderServiceRemote/WhenIGetAProvider.cs b/src/SFA.DAS.EmployerFinance.UnitTests/Services/ProviderServiceTests/ProviderServiceRemote/WhenIGetAProvider.cs index c093d86248..2f66bff2fb 100644 --- a/src/SFA.DAS.EmployerFinance.UnitTests/Services/ProviderServiceTests/ProviderServiceRemote/WhenIGetAProvider.cs +++ b/src/SFA.DAS.EmployerFinance.UnitTests/Services/ProviderServiceTests/ProviderServiceRemote/WhenIGetAProvider.cs @@ -1,6 +1,5 @@ using System; using System.Threading.Tasks; -using AutoFixture; using FluentAssertions; using Moq; using NUnit.Framework; @@ -25,8 +24,11 @@ internal class WhenIGetAProvider [SetUp] public void Arrange() { - var fixture = new Fixture(); - _provider = fixture.Create(); + + _provider = new ProviderResponseItem + { + Email = "test@test.com" + }; _mockProviderService = new Mock(); _mockApiClient = new Mock(); _mockLog = new Mock();