Ejemplo n.º 1
0
        /// <summary>
        /// Runs the health check with the given name.
        /// </summary>
        /// <param name="name"> the health check's name</param>
        /// <returns>the result of the health check</returns>
        public HealthCheck.Result RunHealthCheck(string name)
        {
            HealthCheck healthCheck = null;

            if (!_checks.TryGetValue(name, out healthCheck))
            {
                throw new InvalidOperationException("Given health check not found");
            }
            return(healthCheck.Execute());
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Registers an application <see cref="HealthCheck" /> with a given name
 /// </summary>
 /// <param name="name">The named health check instance</param>
 /// <param name="check">The <see cref="HealthCheck" /> function</param>
 public void Register(string name, HealthCheck check)
 {
     _checks.TryAdd(name, check);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Registers an application <see cref="HealthCheck" /> with a given name
 /// </summary>
 /// <param name="name">The named health check instance</param>
 /// <param name="check">The <see cref="HealthCheck" /> function</param>
 public void Register(string name, HealthCheck check)
 {
     _checks.TryAdd(name, check);
 }