public void Should_save_time_message_When_message_is_within_sample_rate() { var expected = "domain.timer.time,app=appname,tag1=value1,tag2=value2 10 1000 sum,count,10 50"; var messageBuffer = new MessageBufferFake(); this.luckyCoin.Setup((lc) => lc.Throw(It.IsAny <int>())).Returns(true); this.timestamp.Setup((ts) => ts.Now()).Returns(1000); var client = new StatfulClient(this.configurationGateway, messageBuffer, this.timestamp.Object, this.luckyCoin.Object); client.Time("time", 10, "tag2=value2", "sum,count", 10, 50); Assert.AreEqual(expected, messageBuffer.message); }
public void Should_save_counter_message_when_aggregations_are_defined() { var messageBuffer = new MessageBufferFake(); this.luckyCoin.Setup((lc) => lc.Throw(It.IsAny <int>())).Returns(true); this.timestamp.Setup((ts) => ts.Now()).Returns(1000); var client = new StatfulClient(this.configurationGateway, messageBuffer, this.timestamp.Object, this.luckyCoin.Object); client.Inc("inc", 10, "tag2=value2", "avg", 10, 50); var expected = "domain.counter.inc,app=appname,tag1=value1,tag2=value2 10 1000 avg,10 50"; Assert.AreEqual(expected, messageBuffer.message); }