Exemplo n.º 1
0
        /// <summary>
        /// Returns the number of errors recorded for the given metric.
        /// </summary>
        /// <param name="errorType">The type of the error recorded.</param>
        /// <param name="pingName">Represents the name of the ping to retrieve the metric for.
        /// Defaults to the first value in `sendInPings`.</param>
        /// <returns>the number of errors recorded for the metric.</returns>
        public Int32 TestGetNumRecordedErrors(Testing.ErrorType errorType, string pingName = null)
        {
            Dispatchers.AssertInTestingMode();

            string ping = pingName ?? sendInPings[0];


            switch (submetric)
            {
            case BooleanMetricType _:
            {
                return(LibGleanFFI.glean_labeled_boolean_test_get_num_recorded_errors(handle, (int)errorType, ping));
            }

            case CounterMetricType _:
            {
                return(LibGleanFFI.glean_labeled_counter_test_get_num_recorded_errors(handle, (int)errorType, ping));
            }

            case StringMetricType _:
            {
                return(LibGleanFFI.glean_labeled_string_test_get_num_recorded_errors(handle, (int)errorType, ping));
            }

            default:
                throw new InvalidOperationException("Can not return errors for this metric type");
            }
        }