public void Stop_WhenNotStarted_DoesNothing() { var client = new MockSensuClient(); _sut = new Pacemaker(client); _sut.Stop(); }
public void Start_WithPeriodOf1sec_Sends2MessagesIn2sec() { var client = new MockSensuClient(); _sut = new Pacemaker(client); _sut.Start(new Heartbeat("testApp", 1)); Thread.Sleep(1900); _sut.Stop(); Assert.Equal(2, client.Messages.Count); }
public void Stop_WhileHeardbeatRunning_StopsHeartbeat() { var client = new MockSensuClient(); _sut = new Pacemaker(client); _sut.Start(new Heartbeat("testApp", 1)); Thread.Sleep(5); _sut.Stop(); Thread.Sleep(2000); Assert.Equal(1, client.Messages.Count); }
public void Dispose() { _sut?.Stop(); _sut = null; }