public void DefaultPageOptions_HasDefaultPath() { // Arrange & act var options = new RuntimeInfoPageOptions(); // Assert Assert.Equal(DefaultPath, options.Path.Value); }
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)); }
/// <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; }
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)); }