public void If_a_heartbeat_is_missed_the_saga_should_mark_the_endpoint_suspect() { MakeSagaSuspect(); HealthSaga saga = GetSaga(); saga.ShouldNotBeNull(); saga.ShouldBeInState(HealthSaga.Suspect); }
public void Should_publish_heartbeats_to_the_service() { LocalBus.Publish(new EndpointCameOnline(Guid.NewGuid(), LocalBus.ControlBus.Endpoint.Address.Uri, LocalBus.Endpoint.Address.Uri, 0)); HealthSaga saga = GetSaga(); saga.ShouldNotBeNull(); saga.ShouldBeInState(HealthSaga.Healthy); }
public void The_HealthClient_should_publish_heartbeats() { LocalBus.Publish(new EndpointCameOnline(_id, LocalBus.ControlBus.Endpoint.Uri, LocalBus.Endpoint.Uri, 0)); Thread.Sleep(500); HealthSaga saga = Repository.Where(x => x.CorrelationId == _id).FirstOrDefault(); saga.ShouldNotBeNull(); saga.CurrentState.ShouldEqual(HealthSaga.Healthy); }
public void If_a_saga_is_suspect_a_heartbeat_should_fix() { MakeSagaSuspect(); HealthSaga saga = GetSaga(); LocalBus.Publish(new Heartbeat(saga.CorrelationId, LocalBus.ControlBus.Endpoint.Address.Uri, LocalBus.Endpoint.Address.Uri, 0)); saga.ShouldNotBeNull(); saga.ShouldBeInState(HealthSaga.Healthy); }
public void If_endpoint_down_a_heartbeat_should_revive() { MakeSagaDown(); HealthSaga saga = GetSaga(); LocalBus.Publish(new Heartbeat(saga.CorrelationId, LocalBus.ControlBus.Endpoint.Address.Uri, LocalBus.Endpoint.Address.Uri, 0)); saga.ShouldNotBeNull(); saga.ShouldBeInState(HealthSaga.Healthy); }
public void If_a_saga_is_suspect_a_pingtimeout_should_make_it_down() { MakeSagaSuspect(); HealthSaga saga = GetSaga(); LocalBus.Publish(new TimeoutExpired { CorrelationId = saga.CorrelationId, Tag = 2 }); saga.ShouldNotBeNull(); saga.ShouldBeInState(HealthSaga.Down); }
void MakeSagaDown() { MakeSagaSuspect(); HealthSaga saga = GetSaga(); LocalBus.Publish(new TimeoutExpired { CorrelationId = saga.CorrelationId, Tag = 2 }); saga.ShouldNotBeNull(); saga.ShouldBeInState(HealthSaga.Down); }
public void MakeSagaSuspect() { LocalBus.Publish(new EndpointCameOnline(Guid.NewGuid(), LocalBus.ControlBus.Endpoint.Address.Uri, LocalBus.Endpoint.Address.Uri, 0)); HealthSaga saga = GetSaga(); saga.ShouldNotBeNull(); saga.ShouldBeInState(HealthSaga.Healthy); LocalBus.Publish(new TimeoutExpired { CorrelationId = saga.CorrelationId, Tag = 1 }); saga.ShouldBeInState(HealthSaga.Suspect); }