protected override void DoUpdateVisuals(OverviewForecastTypeOption typeOption)
 {
     if (typeOption.ForecastType.Id.Equals(Forecast.ForecastType.Id))
     {
         ForceHideByForecastType = !typeOption.IsSelected;
     }
 }
Esempio n. 2
0
        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;
        }
Esempio n. 4
0
        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));
        }
Esempio n. 5
0
 protected override void DoUpdateVisuals(OverviewForecastTypeOption typeOption)
 {
     // Do nothing
 }
Esempio n. 6
0
 /// <summary>
 /// Updates the visual state for this forecast (Both visibility and displayvalue)
 /// </summary>
 /// <param name="typeOption"></param>
 protected abstract void DoUpdateVisuals(OverviewForecastTypeOption typeOption);
Esempio n. 7
0
 /// <summary>
 /// Update visual-state
 /// </summary>
 /// <param name="typeOption"></param>
 public void UpdateVisuals(OverviewForecastTypeOption typeOption)
 {
     DoUpdateVisuals(typeOption);
     OnPropertyChanged(() => DisplayValue);
 }