Example #1
0
        public void NullArguments_ArgumentNullException()
        {
            var builder      = new ApplicationBuilder(serviceProvider: null);
            var noMiddleware = new ApplicationBuilder(serviceProvider: null).Build();
            var noOptions    = new MapOptions();

            Assert.Throws <ArgumentNullException>(() => builder.Map("/foo", configuration: null));
            Assert.Throws <ArgumentNullException>(() => new MapMiddleware(noMiddleware, null));
        }
Example #2
0
        /// <summary>
        /// Creates a new instance of <see cref="MapMiddleware"/>.
        /// </summary>
        /// <param name="next">The delegate representing the next middleware in the request pipeline.</param>
        /// <param name="options">The middleware options.</param>
        public MapMiddleware(RequestDelegate next, MapOptions options)
        {
            if (next == null)
            {
                throw new ArgumentNullException(nameof(next));
            }

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

            _next    = next;
            _options = options;
        }