Beispiel #1
0
        public void UseSpa_RootPathNotSet_ShouldThrowInvalidOperationException()
        {
            var services = GetServiceCollection();

            services.AddSpaStaticFilesWithUrlRewrite(_ => { });

            var serviceProvider    = services.BuildServiceProvider();
            var applicationBuilder = new MockApplicationBuilder(serviceProvider);
            var exception          = Assert.Throws <InvalidOperationException>(
                () => applicationBuilder.UseSpa(_ => { }));

            Assert.Contains(nameof(UrlRewriteSpaStaticFilesOptions.RootPath), exception.Message, StringComparison.Ordinal);
        }
Beispiel #2
0
        public void UseSpa_ShouldNotThrowException()
        {
            var services = GetServiceCollection();

            services.AddSpaStaticFilesWithUrlRewrite(configuration =>
            {
                configuration.RootPath = "Root";
            });

            var serviceProvider    = services.BuildServiceProvider();
            var applicationBuilder = new MockApplicationBuilder(serviceProvider);

            applicationBuilder.UseSpa(x => { });
        }