protected override void DoUpdateVisuals(OverviewForecastTypeOption typeOption) { if (typeOption.ForecastType.Id.Equals(Forecast.ForecastType.Id)) { ForceHideByForecastType = !typeOption.IsSelected; } }
protected override void DoUpdateVisuals(OverviewForecastTypeOption typeOption) { // Toggled forecasttype is "Project" if (typeOption.ForecastType.Id.Equals(_projectForecastTypeId)) { _projectTypeDisabled = !typeOption.IsSelected; } // Toggled forecasttype is the same as this objects forecasttype else if (typeOption.ForecastType.Id.Equals(Forecast.ForecastType.Id)) // Same type as this { _ownTypeDisabled = !typeOption.IsSelected; } ForceHideByForecastType = _ownTypeDisabled && (_projectTypeDisabled || Forecast.HasNoProjects); }
/// <summary> /// Sets up the state of the object, so displayvalue returns the expected value /// </summary> /// <param name="typeOption">Forecasttype that has been enabled/disabled</param> protected override void DoUpdateVisuals(OverviewForecastTypeOption typeOption) { // Toggled forecasttype is "Project" if (typeOption.ForecastType.Id.Equals(_projectForecastTypeId)) { _projectTypeDisabled = !typeOption.IsSelected; } // Toggled forecasttype is the same as this objects forecasttype else if (typeOption.ForecastType.Id.Equals(Forecast.ForecastType.Id)) { _ownTypeDisabled = !typeOption.IsSelected; } // ForceHide if this forecast is not related to current project/company search or both "Project" and forecasts own type are disabled ForceHideByForecastType = (!IsRelatedToCurrentProjectOrCompany || _projectTypeDisabled) && _ownTypeDisabled; }
public void UpdateForecastTypeForceHide_AllAreOfSameForecastType_AllForceHideIsTrue() { // Arrange var forecastType = Fixture.Create <ForecastType>(); forecastType.Name = "Sometype"; Fixture.Inject(forecastType); var forecast1 = CreateMock <ForecastOverviewForecast>(); var forecast2 = CreateMock <ForecastOverviewForecast>(); var forecast3 = CreateMock <ForecastOverviewForecast>(); var sut = new ForecastOverviewForecastMonths { new ForecastOverviewForecastMonth { Forecasts = new List <ForecastOverviewForecast> { forecast1.Object } }, new ForecastOverviewForecastMonth { Forecasts = new List <ForecastOverviewForecast> { forecast2.Object } }, new ForecastOverviewForecastMonth { Forecasts = new List <ForecastOverviewForecast> { forecast3.Object } }, }; var option = new OverviewForecastTypeOption(forecastType) { IsSelected = false }; // Act sut.UpdateForecastTypeForceHide(option); // Assert forecast1.Verify(x => x.UpdateVisuals(option)); forecast2.Verify(x => x.UpdateVisuals(option)); forecast3.Verify(x => x.UpdateVisuals(option)); }
protected override void DoUpdateVisuals(OverviewForecastTypeOption typeOption) { // Do nothing }
/// <summary> /// Updates the visual state for this forecast (Both visibility and displayvalue) /// </summary> /// <param name="typeOption"></param> protected abstract void DoUpdateVisuals(OverviewForecastTypeOption typeOption);
/// <summary> /// Update visual-state /// </summary> /// <param name="typeOption"></param> public void UpdateVisuals(OverviewForecastTypeOption typeOption) { DoUpdateVisuals(typeOption); OnPropertyChanged(() => DisplayValue); }