diff --git a/TransactionProcessor.BusinessLogic.Tests/Manager/TransactionProcessorManagerTests.cs b/TransactionProcessor.BusinessLogic.Tests/Manager/TransactionProcessorManagerTests.cs index c808c751..74906abf 100644 --- a/TransactionProcessor.BusinessLogic.Tests/Manager/TransactionProcessorManagerTests.cs +++ b/TransactionProcessor.BusinessLogic.Tests/Manager/TransactionProcessorManagerTests.cs @@ -1,6 +1,7 @@ using Moq; using Shared.DomainDrivenDesign.EventSourcing; using Shared.EventStore.Aggregate; +using Shared.Logger; using Shared.Serialisation; using Shouldly; using SimpleResults; @@ -33,6 +34,7 @@ public class TransactionProcessorManagerTests public TransactionProcessorManagerTests() { + Logger.Initialise(Microsoft.Extensions.Logging.Abstractions.NullLogger.Instance); this.TransactionProcessorReadModelRepository = new Mock(); StringSerialiser.Initialise(new Shared.Serialisation.SystemTextJsonSerializer(new System.Text.Json.JsonSerializerOptions())); this.AggregateService = new Mock(); @@ -447,6 +449,19 @@ public async Task TransactionProcessorManager_GetMerchantContracts_RepoCallFaile getMerchantContractsResult.IsFailed.ShouldBeTrue(); } + [Fact] + public async Task TransactionProcessorManager_GetMerchantContracts_RepositoryThrows_ResultFailed() + { + this.TransactionProcessorReadModelRepository + .Setup(e => e.GetMerchantContracts(It.IsAny(), It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Test exception")); + + Result> getMerchantContractsResult = await this.TransactionProcessorManager.GetMerchantContracts(TestData.EstateId, TestData.MerchantId, CancellationToken.None); + + getMerchantContractsResult.IsFailed.ShouldBeTrue(); + getMerchantContractsResult.Message.ShouldBe("Test exception"); + } + [Fact] public async Task TransactionProcessorManager_GetMerchants_MerchantListIsReturned() {