public void verify_retry_start_execution_tracking() { AnotherSampleCommandHandler.numOfFailure = 2; AnotherSampleCommandHandler.exceptionToThrow = new ConflictingCommandException("TEST_1", null); AnotherSampleCommandHandler.setEventOnThrow = false; var sampleMessage = new AnotherSampleTestCommand(10); _bus.Send(sampleMessage); var handled = _handler.Reset.WaitOne(10000); //cycle until we found handled message on tracking TrackedMessageModel track = null; DateTime startTime = DateTime.Now; do { Thread.Sleep(50); var tracks = _messages.FindAll().ToList(); Assert.That(tracks, Has.Count.EqualTo(1)); track = tracks.Single(); } while ( track.ExecutionCount < AnotherSampleCommandHandler.numOfFailure && DateTime.Now.Subtract(startTime).TotalSeconds < 4 ); Assert.That(track.MessageId, Is.EqualTo(sampleMessage.MessageId.ToString())); Assert.That(track.Description, Is.EqualTo(sampleMessage.Describe())); Assert.That(track.StartedAt, Is.Not.Null); Assert.That(track.CompletedAt, Is.Not.Null); Assert.That(track.FailedAt, Is.Null); Assert.That(track.DispatchedAt, Is.Null); Assert.That(track.LastExecutionStartTime, Is.Not.Null); Assert.That(track.ExecutionCount, Is.EqualTo(3)); Assert.That(track.ExecutionStartTimeList.Length, Is.EqualTo(3)); }
public void verify_elaboration_tracking() { var sampleMessage = new SampleTestCommand(10); _bus.Send(sampleMessage); var handled = _handler.Reset.WaitOne(10000); //cycle until we found handled message on tracking TrackedMessageModel track = null; DateTime startTime = DateTime.Now; do { Thread.Sleep(50); var tracks = _messages.FindAll().ToList(); Assert.That(tracks, Has.Count.EqualTo(1)); track = tracks.Single(); } while ( track.CompletedAt == null && DateTime.Now.Subtract(startTime).TotalSeconds < 4 ); Assert.That(track.MessageId, Is.EqualTo(sampleMessage.MessageId.ToString())); Assert.That(track.LastExecutionStartTime, Is.Not.Null); Assert.That(track.ExecutionCount, Is.EqualTo(1)); Assert.That(track.ExecutionStartTimeList.Length, Is.EqualTo(1)); }