public override void When()
 {
     var healthChecker = new HealthCheckerBuilder()
         .WithHealthChecks(() => new[] {new ApplicationIsRunning()})
         .Build();
     _result = healthChecker.Check();
 }
        public override void When()
        {
            var healthChecker = new HealthCheckerBuilder()
                                .WithHealthChecks(() => new[] { new ApplicationIsRunning() })
                                .Build();

            _result = healthChecker.Check();
        }
Example #3
0
        public override void When()
        {
            var healthChecker = new HealthCheckerBuilder()
                                .WithHealthChecks(() => new IHealthCheck[0])
                                .Build();

            _result = healthChecker.Check();
        }
Example #4
0
        public void CanScanForHealthCheckInstancesUsingHealthChecker()
        {
            // Arrange
            var healthChecker = new HealthCheckerBuilder().WithHealthChecksFromAssemblies(typeof(TestHealthCheck).Assembly).Build();

            // Act
            var healthCheckOutcome = healthChecker.Check();

            // Assert
            healthCheckOutcome.Message.ShouldBe("All okay");
        }
Example #5
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            var thisAssembly = typeof (MvcApplication).Assembly;

            var healthChecker = new HealthCheckerBuilder()
                .WithHealthChecksFromAssemblies(thisAssembly)
                .Build();

            routes.RegisterHealthCheck(healthChecker);

            routes.MapRoute("Default", "{controller}/{action}/{id}", new {controller = "Home", action = "Index", id = UrlParameter.Optional}
                );
        }
Example #6
0
        protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);

            container.Register<JsonSerializer, CustomJsonSerializer>();

            var notDeadYetAssembly = typeof (IHealthChecker).Assembly;
            var thisAssembly = typeof (Bootstrapper).Assembly;

            var healthChecker = new HealthCheckerBuilder()
                .WithHealthChecksFromAssemblies(thisAssembly, notDeadYetAssembly)
                .Build();

            container.Register(healthChecker);
        }
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            var thisAssembly = typeof(MvcApplication).Assembly;

            var healthChecker = new HealthCheckerBuilder()
                                .WithHealthChecksFromAssemblies(thisAssembly)
                                .Build();

            routes.RegisterHealthCheck(healthChecker);

            routes.MapRoute("Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional }
                            );
        }
        protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);

            container.Register <JsonSerializer, CustomJsonSerializer>();

            var notDeadYetAssembly = typeof(IHealthChecker).Assembly;
            var thisAssembly       = typeof(Bootstrapper).Assembly;

            var healthChecker = new HealthCheckerBuilder()
                                .WithHealthChecksFromAssemblies(thisAssembly, notDeadYetAssembly)
                                .Build();

            container.Register(healthChecker);
        }
        /// <summary>
        /// Adds <see cref="IHealthChecker"/> instance to the specified <see cref="IServiceCollection"/>.
        /// </summary>
        public static IServiceCollection AddHealthCheck(this IServiceCollection services, Action <HealthCheckerBuilder> healthCheckerBuilderAction)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

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

            var builder = new HealthCheckerBuilder();

            healthCheckerBuilderAction(builder);

            // We add it as a singleton to that we are able to use it as part of the middleware pipeline
            return(services.AddSingleton <IHealthChecker>(sp => builder.Build()));
        }
Example #10
0
        public static void Register(HttpConfiguration config)
        {
            var thisAssembly = typeof (WebApiConfig).Assembly;

            var healthChecker = new HealthCheckerBuilder()
                .WithHealthChecksFromAssemblies(thisAssembly)
                .Build();

            config.RegisterHealthCheck(healthChecker);

            config.Routes.MapHttpRoute("DefaultApi", "api/{controller}/{id}", new {id = RouteParameter.Optional}
                );

            // Uncomment the following line of code to enable query support for actions with an IQueryable or IQueryable<T> return type.
            // To avoid processing unexpected or malicious queries, use the validation settings on QueryableAttribute to validate incoming queries.
            // For more information, visit http://go.microsoft.com/fwlink/?LinkId=279712.
            //config.EnableQuerySupport();

            // To disable tracing in your application, please comment out or remove the following line of code
            // For more information, refer to: http://www.asp.net/web-api
            config.EnableSystemDiagnosticsTracing();
        }
Example #11
0
        public static void Register(HttpConfiguration config)
        {
            var thisAssembly = typeof(WebApiConfig).Assembly;

            var healthChecker = new HealthCheckerBuilder()
                                .WithHealthChecksFromAssemblies(thisAssembly)
                                .Build();

            config.RegisterHealthCheck(healthChecker);

            config.Routes.MapHttpRoute("DefaultApi", "api/{controller}/{id}", new { id = RouteParameter.Optional }
                                       );

            // Uncomment the following line of code to enable query support for actions with an IQueryable or IQueryable<T> return type.
            // To avoid processing unexpected or malicious queries, use the validation settings on QueryableAttribute to validate incoming queries.
            // For more information, visit http://go.microsoft.com/fwlink/?LinkId=279712.
            //config.EnableQuerySupport();

            // To disable tracing in your application, please comment out or remove the following line of code
            // For more information, refer to: http://www.asp.net/web-api
            config.EnableSystemDiagnosticsTracing();
        }