public void ExpandViewLocations_ReturnsViewLocations() { ActionContext context = new ActionContext(new DefaultHttpContext(), new RouteData(), new ActionDescriptor()); ViewLocationExpanderContext expander = new ViewLocationExpanderContext(context, "Index", null, null, true); IEnumerable<String> expected = new[] { "/Views/{1}/{0}.cshtml", "/Views/Shared/{0}.cshtml" }; IEnumerable<String> actual = new ViewLocationExpander().ExpandViewLocations(expander, null); Assert.Equal(expected, actual); }
public IEnumerable<string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable<string> viewLocations) { string theme = null; if (context.Values.TryGetValue(THEME_KEY, out theme)) { IEnumerable<string> themeLocations = new[] { $"/Themes/{theme}/{{1}}/{{0}}.cshtml", $"/Themes/{theme}/Shared/{{0}}.cshtml" }; string tenant; if (context.Values.TryGetValue(TENANT_KEY, out tenant)) { themeLocations = ExpandTenantLocations(tenant, themeLocations); } viewLocations = themeLocations.Concat(viewLocations); } return viewLocations; }
public static string GetJson(HttpResponse response) { var b = new { Title = "Professional C# 6", Publisher = "Wrox Press", Author = "Christian Nagel" }; string json = JsonConvert.SerializeObject(b); response.ContentType = "application/json"; return json; }