Tests.StatsdTests.Timer.add_timer_with_lamba_still_records_on_error_and_still_bubbles_up_exception C# (CSharp) Method

add_timer_with_lamba_still_records_on_error_and_still_bubbles_up_exception() private method

            public void add_timer_with_lamba_still_records_on_error_and_still_bubbles_up_exception()
            {
                const string statName = "name";

                var stopwatch = MockRepository.GenerateMock<IStopwatch>();
                stopwatch.Stub(x => x.ElapsedMilliseconds()).Return(500);
                _stopwatch.Stub(x => x.Get()).Return(stopwatch);

                var s = new Statsd(_udp, _randomGenerator, _stopwatch);

                Assert.Throws<InvalidOperationException>(() => s.Add(() => { throw new InvalidOperationException(); }, statName));

                Assert.That(s.Commands.Count, Is.EqualTo(1));
                Assert.That(s.Commands[0], Is.EqualTo("name:500|ms"));
            }