示例#1
0
        public void BypassUrlPaths(PathString[] pathStrings, Type expectedException)
        {
            MiddlewareOptionsBuilder builder = new MiddlewareOptionsBuilder(_dirMapperSvc);
            Func <IEnumerable <BypassUrlPathOption> > testFunc = () =>
            {
                builder.BypassUrlPaths(pathStrings, StringComparison.Ordinal);
                return(builder.GetOptions().GetAll <BypassUrlPathOption>());
            };

            if (expectedException != null)
            {
                testFunc.ShouldThrow(expectedException);
            }
            else
            {
                IEnumerable <BypassUrlPathOption> options = testFunc
                                                            .ShouldNotThrow()
                                                            .ShouldNotBeNull();

                if (pathStrings != null)
                {
                    options
                    .Count()
                    .ShouldBe(pathStrings.Length);
                }
            }
        }