public void DefaultValue_AddsFeatureFolderViewLocations() { var configure = new MvcServiceOptions(); var options = new RazorViewEngineOptions(); options.AreaViewLocationFormats.Clear(); options.ViewLocationFormats.Clear(); configure.Razor(options); Assert.Contains("/Features/Shared/Partials/{0}.cshtml", options.AreaViewLocationFormats); Assert.Contains("/Features/Shared/{0}.cshtml", options.AreaViewLocationFormats); Assert.Contains("/Features/{2}/Shared/Partials/{0}.cshtml", options.AreaViewLocationFormats); Assert.Contains("/Features/{2}/Shared/{0}.cshtml", options.AreaViewLocationFormats); Assert.Contains("/Features/{2}/{1}/Partials/{0}.cshtml", options.AreaViewLocationFormats); Assert.Contains("/Features/{2}/{1}/{0}.cshtml", options.AreaViewLocationFormats); Assert.Contains("/Features/Shared/Partials/{0}.cshtml", options.ViewLocationFormats); Assert.Contains("/Features/Shared/{0}.cshtml", options.ViewLocationFormats); Assert.Contains("/Features/{1}/Partials/{0}.cshtml", options.ViewLocationFormats); Assert.Contains("/Features/{1}/{0}.cshtml", options.ViewLocationFormats); }
public void WhenCalled_SetsValue() { var configure = new MvcServiceOptions(); var options = new Action <RouteOptions>(o => { }); configure.Routing = options; Assert.Equal(options, configure.Routing); }
public void WhenCalled_SetsValue() { var configure = new MvcServiceOptions(); var options = new Action <MvcViewOptions>(o => { }); configure.Views = options; Assert.Equal(options, configure.Views); }
public void WhenCalled_SetsValue() { var configure = new MvcServiceOptions(); var options = new TrackingConsentOptions(); configure.TrackingConsent = options; Assert.Equal(options, configure.TrackingConsent); }
public void DefaultValue_ConfiguresOptions() { var configure = new MvcServiceOptions(); var options = new MvcViewOptions(); configure.Views(options); Assert.False(options.HtmlHelperOptions.ClientValidationEnabled); }
public void WhenCalled_SetsValue() { var configure = new MvcServiceOptions(); var options = new Action <RazorViewEngineOptions>(o => { }); configure.Razor = options; Assert.Equal(options, configure.Razor); }
public void WhenCalled_SetsValue() { var configure = new MvcServiceOptions(); var options = new Action <StaticFileOptions>(o => { }); configure.StaticFiles = options; Assert.Equal(options, configure.StaticFiles); }
public void DefaultValue_ConfiguresOptions() { var configure = new MvcServiceOptions(); var options = new RouteOptions(); configure.Routing(options); Assert.False(options.AppendTrailingSlash); Assert.True(options.LowercaseUrls); Assert.False(options.LowercaseQueryStrings); }
public void DefaultValue_ConfiguresOptions() { var configure = new MvcServiceOptions(); var options = new JsonOptions(); configure.Json(options); Assert.False(options.JsonSerializerOptions.WriteIndented); Assert.True(options.JsonSerializerOptions.IgnoreNullValues); Assert.Equal(JsonNamingPolicy.CamelCase, options.JsonSerializerOptions.PropertyNamingPolicy); }
public void DefaultValue_ConfiguresOptions() { var configure = new MvcServiceOptions(); var options = Options(); var responseContext = ResponseContext(); configure.StaticFiles(options); options.OnPrepareResponse(responseContext); Assert.Equal("public,max-age=31536000", responseContext.Context.Response.Headers[HeaderNames.CacheControl]); }
public void DefaultValue_ConfiguresOptions() { var configure = new MvcServiceOptions(); var options = new MvcOptions(); configure.Mvc(options); Assert.NotNull(options.Filters.Single( filter => filter is AutoValidateAntiforgeryTokenAttribute)); Assert.NotNull(options.Filters.Single( filter => filter is RequireHttpsAttribute)); Assert.True(options.RequireHttpsPermanent); }
public void DefaultValue_PreservesExistingAction() { var configure = new MvcServiceOptions(); var onPrepareResponseCalled = false; var options = Options(); options.OnPrepareResponse = context => { onPrepareResponseCalled = true; }; var responseContext = ResponseContext(); configure.StaticFiles(options); options.OnPrepareResponse(responseContext); Assert.True(onPrepareResponseCalled); Assert.Equal("public,max-age=31536000", responseContext.Context.Response.Headers[HeaderNames.CacheControl]); }
public void WhenCalled_SetsTrackingConsent() { var options = new MvcServiceOptions(); Assert.NotNull(options.TrackingConsent); }
public void WhenCalled_SetsRouting() { var options = new MvcServiceOptions(); Assert.NotNull(options.Routing); }
public void WhenCalled_SetsViews() { var options = new MvcServiceOptions(); Assert.NotNull(options.Views); }
public void WhenCalled_SetsJson() { var options = new MvcServiceOptions(); Assert.NotNull(options.Json); }
public void DefaultValue_ReturnsOptions() { var configure = new MvcServiceOptions(); Assert.NotNull(configure.TrackingConsent); }
public void WhenCalled_SetsRazor() { var options = new MvcServiceOptions(); Assert.NotNull(options.Razor); }