public void ExpandViewLocations_ViewLocationExpanderContext_IEnumerable_ReturnsExpected(ResponsiveViewLocationFormat format, Device deviceType, IEnumerable <string> viewLocations, IEnumerable <string> expectedViewLocations) { var context = SetupViewLocationExpanderContext(deviceType); var locationExpander = new ResponsiveViewLocationExpander(format); locationExpander.PopulateValues(context); var resultLocations = locationExpander.ExpandViewLocations(context, viewLocations).ToList(); Assert.Equal(expectedViewLocations, resultLocations.ToArray()); }
[Fact]//(Skip = "Fails with NullReferenceExeption because context.Values is not set to instance of an object.")] public void PopulateValues_ViewLocationExpanderContext_Success() { string deviceKey = "device"; // May this one can be public in ResponsiveViewLocationExpander.cs. var context = SetupViewLocationExpanderContext(); var locationExpander = new ResponsiveViewLocationExpander(); locationExpander.PopulateValues(context); Assert.NotEqual(0, context.Values.Count); Assert.Same(context.ActionContext.HttpContext.GetDevice().Device, context.Values[deviceKey]); }
public void ExpandViewLocations_ViewLocationExpanderContext_IEnumerable_ReturnsExpected() { var context = SetupViewLocationExpanderContext(); var viewLocations = new List <string>() { "{0} location1", "{0} location2" }; var locationExpander = new ResponsiveViewLocationExpander(); locationExpander.PopulateValues(context); var resultLocations = locationExpander.ExpandViewLocations(context, viewLocations); Assert.True(viewLocations.Count < resultLocations.ToList().Count); }
public void PopulateValues_Null_ThrowsArgumentNullException() { var locationExpander = new ResponsiveViewLocationExpander(); Assert.Throws <ArgumentNullException>(() => locationExpander.PopulateValues(null)); }