Exemple #1
0
        public void Add_AddsCorrectValues()
        {
            var metrics = new ScopeMetrics("Test");

            metrics.Add(500);
            metrics.Add(500);

            metrics.TotalNanoseconds.Should().Be(1000);
            metrics.Count.Should().Be(2);
        }
Exemple #2
0
        public void Add_ValueIsNegative_ThrowsException()
        {
            var metrics = new ScopeMetrics("Test");

            Action act = () => metrics.Add(-1);

            var exception = act.Should().Throw <ArgumentOutOfRangeException>();

            exception.Which.ParamName.Should().Be("elapsedNs");
            exception.Which.ActualValue.Should().Be(-1);
        }