Пример #1
0
        public static string CssClassForTile(this HtmlHelper helper, VehicleListViewModel list, VehicleModel vehicle)
        {
            VehicleModel selectedItem = list.Vehicles.SelectedItem;

            bool shouldCompact = (list.IsCollapsed && selectedItem == null)
                                 || (selectedItem != null && vehicle.VehicleId != selectedItem.VehicleId);

            return shouldCompact ? "compact" : String.Empty;
        }
Пример #2
0
        public void WhenVehicleSelectedAndNotCollapsed_ThenNoCssClassApplied()
        {
            var notSelected = new VehicleModel(new Vehicle { VehicleId = 1 }, new VehicleStatisticsModel());
            var selected = new VehicleModel(new Vehicle { VehicleId = 2 }, new VehicleStatisticsModel());

            var list = new VehicleListViewModel(new[] { notSelected, selected }, 2) { IsCollapsed = true };

            var actual = _helper.CssClassForTile(list, selected);

            Assert.Equal(string.Empty, actual);
        }
Пример #3
0
        public void WhenNoVehicleSelectedAndNotCollapsed_ThenNoCssClassApplied()
        {
            var vehicle = new VehicleModel(new Vehicle(), new VehicleStatisticsModel());
            var list = new VehicleListViewModel(new[] { vehicle }){ IsCollapsed = false };

            var actual = _helper.CssClassForTile(list, vehicle);

            Assert.Equal(string.Empty, actual);
        }