public void ExpandViewLocations_ViewLocationExpanderContext_Null_ThrowsArgumentNullException()
        {
            var locationExpander = new ResponsiveViewLocationExpander(ResponsiveViewLocationFormat.Suffix);

            Assert.Throws <ArgumentNullException>(() =>
                                                  locationExpander.ExpandViewLocations(SetupViewLocationExpanderContext(Device.Tablet), null !));
        }
        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());
        }
        public void PopulateValues_ViewLocationExpanderContext_Success()
        {
            var deviceKey        = "device"; // May this one can be public in ResponsiveViewLocationExpander.cs.
            var context          = SetupViewLocationExpanderContext(Device.Tablet);
            var locationExpander = new ResponsiveViewLocationExpander(ResponsiveViewLocationFormat.Suffix);

            locationExpander.PopulateValues(context);

            Assert.NotEqual(0, context.Values.Count);
            Assert.Same(context.ActionContext.HttpContext.GetDevice().ToString(), context.Values[deviceKey]);
        }
        public void ExpandViewLocations_NoDevice_ReturnsExpected()
        {
            var context       = SetupViewLocationExpanderContext(Device.Tablet);
            var viewLocations = new List <string> {
                "/Views/{1}/{0}.cshtml", "/Views/Shared/{0}.cshtml"
            };
            var locationExpander = new ResponsiveViewLocationExpander(ResponsiveViewLocationFormat.Suffix);
            var resultLocations  = locationExpander.ExpandViewLocations(context, viewLocations);

            Assert.Equal(viewLocations, resultLocations);
        }
        public void PopulateValues_Null_ThrowsArgumentNullException()
        {
            var locationExpander = new ResponsiveViewLocationExpander(ResponsiveViewLocationFormat.Suffix);

            Assert.Throws <ArgumentNullException>(() => locationExpander.PopulateValues(null !));
        }
        public void ExpandViewLocations_Null_IEnumerable_ThrowsArgumentNullException()
        {
            var locationExpander = new ResponsiveViewLocationExpander(ResponsiveViewLocationFormat.Suffix);

            Assert.Throws <ArgumentNullException>(() => locationExpander.ExpandViewLocations(null !, new List <string>()));
        }
        public void Ctor_ResponsiveViewLocationFormat_Success()
        {
            var locationExpander = new ResponsiveViewLocationExpander(ResponsiveViewLocationFormat.Subfolder);

            Assert.NotNull(locationExpander);
        }