Skip to content

Commit

Permalink
FAT2-295 - Remove autofixture dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
dashton82 committed Dec 30, 2020
1 parent 75c8e35 commit 6a51fb3
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoFixture" Version="4.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
<PackageReference Include="Moq" Version="4.5.28" />
<PackageReference Include="NUnit" Version="3.10.1" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AutoFixture;
using FluentAssertions;
using Moq;
using NUnit.Framework;
Expand Down Expand Up @@ -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<GetStandardsResponse>();
var apiResponse = new GetStandardsResponse
{
Standards = new List<StandardResponseItem>
{
new StandardResponseItem
{
Id = 1
}
}
};
_apiClient.Setup(x => x.Get<GetStandardsResponse>(It.IsAny<GetStandardsRequest>()))
.ReturnsAsync(apiResponse);
_cache.Setup(x => x.Exists("Standards")).Returns(false);
Expand All @@ -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<StandardsView>();
var cacheData = new StandardsView
{
Standards = new List<Standard>
{
new Standard
{
Code = 1
}
}
};
_cache.Setup(x => x.Exists("Standards")).Returns(true);
_cache.Setup(x => x.Get<StandardsView>("Standards")).Returns(cacheData);

Expand All @@ -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<GetFrameworksResponse>();
var apiResponse = new GetFrameworksResponse
{
Frameworks = new List<FrameworkResponseItem>
{
new FrameworkResponseItem
{
Id = "123",
FrameworkName = "test",
PathwayName = "test",
Title = "test"
}
}
};

FrameworksView returnData = null;
_apiClient.Setup(x => x.Get<GetFrameworksResponse>(It.IsAny<GetFrameworksRequest>()))
Expand All @@ -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<FrameworksView>();
var cacheData = new FrameworksView
{
Frameworks = new List<Framework>
{
new Framework
{
Id = "123"
}
}
};
_cache.Setup(x => x.Exists("Frameworks")).Returns(true);
_cache.Setup(x => x.Get<FrameworksView>("Frameworks")).Returns(cacheData);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Threading.Tasks;
using AutoFixture;
using FluentAssertions;
using Moq;
using NUnit.Framework;
Expand All @@ -25,8 +24,11 @@ internal class WhenIGetAProvider
[SetUp]
public void Arrange()
{
var fixture = new Fixture();
_provider = fixture.Create<ProviderResponseItem>();

_provider = new ProviderResponseItem
{
Email = "[email protected]"
};
_mockProviderService = new Mock<IProviderService>();
_mockApiClient = new Mock<IApiClient>();
_mockLog = new Mock<ILog>();
Expand Down

0 comments on commit 6a51fb3

Please sign in to comment.