public void sends_multiple_metrics_individually() { var metric1 = new Counting() { Name = "testMetric", ValueAsInt = 5 }; var metric2 = new Timing() { Name = "testtimer", ValueAsInt = 10 }; var sender = new ImmediateSender(); sender.StatsdUDP = _udp; sender.Send(metric1); sender.Send(metric2); IList<object[]> argsPerCall = _udp.GetArgumentsForCallsMadeOn(x => x.Send(Arg<string>.Is.Anything)); Assert.That(argsPerCall.Count, Is.EqualTo(2)); Assert.That(((string)argsPerCall[0][0]), Is.EqualTo(metric1.Command)); Assert.That(((string)argsPerCall[1][0]), Is.EqualTo(metric2.Command)); }
public void does_not_blow_up_if_udp_send_throws() { var udpStub = MockRepository.GenerateStub<IStatsdUDP>(); udpStub.Stub(x => x.Send(Arg<string>.Is.Anything)).Throw(new Exception()); var metric = new Counting() { Name = "testMetric", ValueAsInt = 1 }; var sender = new ImmediateSender(); sender.StatsdUDP = udpStub; sender.Send(metric); Assert.Pass(); }
public void sends_metric_immediately() { var metric = new Counting() { Name = "testMetric", ValueAsInt = 5 }; var sender = new ImmediateSender(); sender.StatsdUDP = _udp; sender.Send(metric); IList<object[]> argsPerCall = _udp.GetArgumentsForCallsMadeOn(x => x.Send(Arg<string>.Is.Anything)); Assert.That(argsPerCall.Count, Is.EqualTo(1)); Assert.That(((string)argsPerCall[0][0]), Is.EqualTo(metric.Command)); }
public void does_not_blow_up_if_metric_command_throws() { var metric = MockRepository.GenerateStub<Counting>(); metric.Stub(x => x.Command).Throw(new Exception()); var sender = new ImmediateSender(); sender.StatsdUDP = _udp; sender.Send(metric); Assert.Pass(); }