public void GaugeShouldNotAddMetricIfNoNameSpecified() { //Arrange var cacheMock = new Mock <IMetricsCache>(); var metricsLog = new RedisMetricsLog(cacheMock.Object); //Act metricsLog.Gauge("", 1000); //Assert cacheMock.Verify(mock => mock.SetGauge("", 1000), Times.Never()); }
public void GaugeShouldCallCacheSetGauge() { //Arrange var cacheMock = new Mock <IMetricsCache>(); var metricsLog = new RedisMetricsLog(cacheMock.Object); //Act metricsLog.Gauge("gauge_test", 1234); //Assert cacheMock.Verify(mock => mock.SetGauge("gauge_test", 1234), Times.Once()); }
public void GaugeShouldNotUpdateMetricIfDeltaIsLessThanZero() { //Arrange var cacheMock = new Mock <IMetricsCache>(); var metricsLog = new RedisMetricsLog(cacheMock.Object); //Act metricsLog.Gauge("gauge_test", -1); //Assert cacheMock.Verify(mock => mock.SetGauge("gauge_test", -1), Times.Never()); }