Ejemplo n.º 1
0
        public void DefaultPageOptions_HasDefaultPath()
        {
            // Arrange & act
            var options = new RuntimeInfoPageOptions();

            // Assert
            Assert.Equal(DefaultPath, options.Path.Value);
        }
        public void DefaultPageOptions_HasDefaultPath()
        {
            // Arrange & act
            var options = new RuntimeInfoPageOptions();

            // Assert
            Assert.Equal(DefaultPath, options.Path.Value);
        }
Ejemplo n.º 3
0
        public static IApplicationBuilder UseRuntimeInfoPage(
            [NotNull] this IApplicationBuilder builder,
            [NotNull] RuntimeInfoPageOptions options)
        {
            var libraryManager = builder.ApplicationServices.GetService(typeof(ILibraryManager)) as ILibraryManager;

            return(builder.Use(next => new RuntimeInfoMiddleware(next, options, libraryManager).Invoke));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RuntimeInfoMiddleware"/> class
        /// </summary>
        /// <param name="next"></param>
        /// <param name="options"></param>
        public RuntimeInfoMiddleware(
            RequestDelegate next,
            IOptions <RuntimeInfoPageOptions> options)
        {
            if (next == null)
            {
                throw new ArgumentNullException(nameof(next));
            }

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

            _next    = next;
            _options = options.Value;
        }
Ejemplo n.º 5
0
        public static IApplicationBuilder UseRuntimeInfoPage(
            this IApplicationBuilder builder,
            RuntimeInfoPageOptions options)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

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

            var libraryManager     = builder.ApplicationServices.GetService(typeof(ILibraryManager)) as ILibraryManager;
            var runtimeEnvironment = builder.ApplicationServices.GetService(typeof(IRuntimeEnvironment)) as IRuntimeEnvironment;

            return(builder.Use(next => new RuntimeInfoMiddleware(next, options, libraryManager, runtimeEnvironment).Invoke));
        }