public ResponsiveViewLocationExpander(ResponsiveViewLocationFormat format) { if (!Enum.IsDefined(typeof(ResponsiveViewLocationFormat), (int)format)) { throw new InvalidEnumArgumentException(nameof(format)); } _format = format; }
private static IResponsiveCoreBuilder AddViewLocation( this IResponsiveCoreBuilder builder, ResponsiveViewLocationFormat format) { builder.Services.Configure <RazorViewEngineOptions>( options => { options.ViewLocationExpanders.Add(new ResponsiveViewLocationExpander(format)); }); return(builder); }
public void ExpandViewLocations_ViewLocationExpanderContext_IEnumerable_ReturnsExpected( ResponsiveViewLocationFormat format, IEnumerable <string> viewLocations, IEnumerable <string> expectedViewLocations) { var context = SetupViewLocationExpanderContext(); var locationExpander = new ResponsiveViewLocationExpander(format); locationExpander.PopulateValues(context); var resultLocations = locationExpander.ExpandViewLocations(context, viewLocations).ToList(); Assert.Equal(expectedViewLocations, resultLocations.ToList()); }