From 1442d0a364cf707189228de0d43aef22ee660f96 Mon Sep 17 00:00:00 2001 From: Mircea MATEI Date: Thu, 8 Sep 2022 15:23:56 +0300 Subject: [PATCH] #5. Fix StateMachine tests --- .../StateMachines/BatchStateMachine.cs | 2 +- src/SampleBatch.Tests/Integration/BatchStateMachineTests.cs | 6 +++--- src/SampleBatch.Tests/Unit/BatchStateMachineTests.cs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/SampleBatch.Components/StateMachines/BatchStateMachine.cs b/src/SampleBatch.Components/StateMachines/BatchStateMachine.cs index 5f942c1..69c0316 100644 --- a/src/SampleBatch.Components/StateMachines/BatchStateMachine.cs +++ b/src/SampleBatch.Components/StateMachines/BatchStateMachine.cs @@ -90,7 +90,7 @@ public BatchStateMachine() InVar.Timestamp, ProcessingJobCount = x.Saga.ProcessingOrderIds.Count, UnprocessedJobCount = x.Saga.UnprocessedOrderIds.Count, - State = this.GetState(x) + State = this.GetState(x).ToString() })), When(BatchReceived) .Then(context => Touch(context.Saga, context.Message.Timestamp)) diff --git a/src/SampleBatch.Tests/Integration/BatchStateMachineTests.cs b/src/SampleBatch.Tests/Integration/BatchStateMachineTests.cs index 6325457..3766b95 100644 --- a/src/SampleBatch.Tests/Integration/BatchStateMachineTests.cs +++ b/src/SampleBatch.Tests/Integration/BatchStateMachineTests.cs @@ -84,7 +84,7 @@ public async Task should_complete_successfully() { BatchId = NewId.NextGuid(), Timestamp = DateTime.UtcNow, - BatchAction = BatchAction.CancelOrders, + Action = BatchAction.CancelOrders, ActiveThreshold = 5, OrderIds = new Guid[] { Guid.NewGuid(), Guid.NewGuid() } }); @@ -102,14 +102,14 @@ public async Task should_complete_successfully() var job1 = _inMemoryConsumerHarness.Consumed.Select(x => x.Context.Message.OrderId == message.OrderIds[0]).First(); var job2 = _inMemoryConsumerHarness.Consumed.Select(x => x.Context.Message.OrderId == message.OrderIds[1]).First(); - var doneJob1 = await MessageInitializerCache.InitializeMessage( + var (doneJob1, _) = await MessageInitializerCache.InitializeMessage( new { job1.Context.Message.BatchJobId, job1.Context.Message.BatchId, Timestamp = DateTime.UtcNow }); - var doneJob2 = await MessageInitializerCache.InitializeMessage( + var (doneJob2, _) = await MessageInitializerCache.InitializeMessage( new { job2.Context.Message.BatchJobId, diff --git a/src/SampleBatch.Tests/Unit/BatchStateMachineTests.cs b/src/SampleBatch.Tests/Unit/BatchStateMachineTests.cs index 86acdb7..d965dbe 100644 --- a/src/SampleBatch.Tests/Unit/BatchStateMachineTests.cs +++ b/src/SampleBatch.Tests/Unit/BatchStateMachineTests.cs @@ -59,7 +59,7 @@ public async Task should_start() { BatchId = NewId.NextGuid(), Timestamp = DateTime.UtcNow, - BatchAction = BatchAction.CancelOrders, + Action = BatchAction.CancelOrders, ActiveThreshold = 5, OrderIds = new Guid[] { Guid.NewGuid(), Guid.NewGuid() } }); @@ -87,7 +87,7 @@ public async Task should_receive_and_wait() { BatchId = NewId.NextGuid(), Timestamp = DateTime.UtcNow, - BatchAction = BatchAction.CancelOrders, + Action = BatchAction.CancelOrders, ActiveThreshold = 5, OrderIds = new Guid[] { Guid.NewGuid(), Guid.NewGuid() }, DelayInSeconds = 60