Esempio n. 1
0
        public void Should_add_new_property_counters_if_requested()
        {
            var counter = state.ObtainCounter("k1", "v1");

            counter.Value.Should().Be(0);
            counter.Should().BeSameAs(state.Counters["k1"]["v1"]);
        }
Esempio n. 2
0
        public void Should_remove_property_counters_with_zero_values()
        {
            state.ObtainCounter("k1", "a");
            state.ObtainCounter("k1", "b").Increment();
            state.ObtainCounter("k1", "c");
            state.ObtainCounter("k1", "d").Increment();
            state.ObtainCounter("k1", "e").Add(3);
            state.ObtainCounter("k2", "x").Add(4);
            state.ObtainCounter("k3", "y");

            Actualize();

            state.Counters["k1"].Keys.Should().BeEquivalentTo("b", "d", "e");
            state.Counters["k2"].Keys.Should().BeEquivalentTo("x");
            state.Counters["k3"].Keys.Should().BeEmpty();
        }
Esempio n. 3
0
        public void ThrottleAsync_should_register_a_consumption_counter_if_provided_with_a_property()
        {
            Throttle();

            state.ObtainCounter("foo", "bar").Value.Should().Be(1);
        }