public void throws_if_apdex_provider_is_null()
        {
            IApdexProvider provider    = null;
            Action         createApdex = () =>
            {
                var apdex = new DefaultApdexMetric(provider, _clock, true);
            };

            createApdex.ShouldThrow <ArgumentNullException>();
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="TimerMetric" /> class.
        /// </summary>
        /// <param name="apdexProvider">The apdexProvider implementation to use for sampling values to generate the apdex score.</param>
        /// <param name="clock">The clock to use to measure processing duration.</param>
        /// <exception cref="System.ArgumentNullException">
        ///     clock and apdexProvider are required.
        /// </exception>
        public ApdexMetric(IApdexProvider apdexProvider, IClock clock)
        {
            if (clock == null)
            {
                throw new ArgumentNullException(nameof(clock));
            }

            if (apdexProvider == null)
            {
                throw new ArgumentNullException(nameof(apdexProvider));
            }

            _apdexProvider = apdexProvider;
            _clock         = clock;
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="DefaultApdexMetric" /> class.
        /// </summary>
        /// <param name="apdexProvider">The apdexProvider implementation to use for sampling values to generate the apdex score.</param>
        /// <param name="clock">The clock to use to measure processing duration.</param>
        /// <param name="allowWarmup">
        ///     if set to <c>true</c> allows the service to warmup before starting to calculate the apdex,
        ///     the score will intitially be 1 until enough samples have been recorded.
        /// </param>
        /// <exception cref="ArgumentNullException">
        ///     clock and apdexProvider are required.
        /// </exception>
        public DefaultApdexMetric(IApdexProvider apdexProvider, IClock clock, bool allowWarmup)
        {
            if (clock == null)
            {
                throw new ArgumentNullException(nameof(clock));
            }

            if (apdexProvider == null)
            {
                throw new ArgumentNullException(nameof(apdexProvider));
            }

            _apdexProvider = apdexProvider;
            _clock         = clock;
            _allowWarmup   = allowWarmup;
        }