Skip to content

Commit 6908aa0

Browse files
fix failing test
1 parent 8b40d3b commit 6908aa0

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

TransactionProcessor.ProjectionEngine.Tests/ProjectionHandlerTests.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
namespace TransactionProcessor.ProjectionEngine.Tests;
22

33
using Dispatchers;
4+
using Microsoft.Extensions.Configuration;
45
using Moq;
56
using Projections;
67
using Repository;
78
using Shared.DomainDrivenDesign.EventSourcing;
9+
using Shared.General;
810
using Shouldly;
911
using State;
1012

1113
public class ProjectionHandlerTests{
1214

15+
public ProjectionHandlerTests(){
16+
Shared.Logger.Logger.Initialise(Shared.Logger.NullLogger.Instance);
17+
IConfigurationRoot configurationRoot = new ConfigurationBuilder().AddInMemoryCollection(TestData.DefaultAppSettings).Build();
18+
ConfigurationReader.Initialise(configurationRoot);
19+
}
20+
1321
[Fact]
1422
public async Task ProjectionHandler_Handle_NullEvent_EventHandled(){
1523
Mock<IProjectionStateRepository<MerchantBalanceState>> repo = new Mock<IProjectionStateRepository<MerchantBalanceState>>();
@@ -57,8 +65,6 @@ public async Task ProjectionHandler_Handle_StateNotFoundInRepository_EventHandle
5765
[Fact]
5866
public async Task ProjectionHandler_Handle_StateFoundInRepository_NoChanges_EventHandled()
5967
{
60-
Shared.Logger.Logger.Initialise(Shared.Logger.NullLogger.Instance);
61-
6268
Mock<IProjectionStateRepository<MerchantBalanceState>> repo = new Mock<IProjectionStateRepository<MerchantBalanceState>>();
6369
Mock<IProjection<MerchantBalanceState>> projection = new Mock<IProjection<MerchantBalanceState>>();
6470
Mock<IStateDispatcher<MerchantBalanceState>> stateDispatcher = new Mock<IStateDispatcher<MerchantBalanceState>>();
@@ -80,8 +86,6 @@ public async Task ProjectionHandler_Handle_StateFoundInRepository_NoChanges_Even
8086
[Fact]
8187
public async Task ProjectionHandler_Handle_StateFoundInRepository_ChangesMade_EventHandled()
8288
{
83-
Shared.Logger.Logger.Initialise(Shared.Logger.NullLogger.Instance);
84-
8589
Mock<IProjectionStateRepository<MerchantBalanceState>> repo = new Mock<IProjectionStateRepository<MerchantBalanceState>>();
8690
Mock<IProjection<MerchantBalanceState>> projection = new Mock<IProjection<MerchantBalanceState>>();
8791
Mock<IStateDispatcher<MerchantBalanceState>> stateDispatcher = new Mock<IStateDispatcher<MerchantBalanceState>>();

TransactionProcessor.ProjectionEngine.Tests/TestData.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ public static TransactionHasStartedEvent GetTransactionHasStartedEvent(Decimal?
167167
public static IReadOnlyDictionary<String, String> DefaultAppSettings =>
168168
new Dictionary<String, String>
169169
{
170+
["AppSettings:ProjectionTraceThresholdInSeconds"] = "1",
170171
["AppSettings:ClientId"] = "clientId",
171172
["AppSettings:ClientSecret"] = "clientSecret",
172173
["AppSettings:UseConnectionStringConfig"] = "false",

0 commit comments

Comments
 (0)