示例#1
0
        public void BypassFileExtensions_WithNullOrEmptyArray_ShouldThrow(string[] extensions, Type expectedException)
        {
            MiddlewareOptionsBuilder builder = new MiddlewareOptionsBuilder(_dirMapperSvc);
            Action testAction = () =>
            {
                builder.BypassFileExtensions(extensions);
            };

            testAction.ShouldThrow(expectedException);
        }
示例#2
0
        public void BypassFileExtensions_WithValidExtensions_ShouldSucceed()
        {
            string[] extensions = new string[] { "txt", "html" };
            MiddlewareOptionsBuilder builder = new MiddlewareOptionsBuilder(_dirMapperSvc);

            builder.BypassFileExtensions(extensions);

            IEnumerable <BypassFileExtensionOption> options =
                builder.GetOptions().GetAll <BypassFileExtensionOption>();

            options.ShouldNotBeEmpty();
            options.Count()
            .ShouldBe(extensions.Length);
            extensions
            .ShouldContain(options.First().Value);
        }