public void CreateForecastMonths_TwoMonthsInSource_MapsAsExpected() { // Arrange var types = Fixture.Create<ObservableCollection<OverviewForecastTypeOption>>(); var source = Fixture.Create<List<ForecastMonthDto>>(); var updated = new ForecastOverviewForecastMonths(); var dates = Fixture.Create<ForecastDates>(); var searchOptionsMock = CreateMock<ForecastOverviewSearchOptions>(); var vmMock = Fixture.Create <Mock<IForecastOverviewViewModel>>(); vmMock.SetupGet(x => x.ListOptions).Returns(new OverviewListOptions {ForecastTypeOptions = types}); vmMock.SetupGet(x => x.Dates).Returns(dates); vmMock.SetupGet(x => x.SearchOptions).Returns(searchOptionsMock.Object); vmMock.SetupGet(x => x.UserRegistrations).Returns(updated); var sut = Fixture.Create<ForecastOverviewDataGenerator>(); // Act sut.CreateForecastMonths(vmMock.Object, source, 1); // Assert Assert.That(updated.Count, Is.EqualTo(source.Count)); foreach (var forecastDate in dates) { foreach (var userForecastMonth in updated) { // Test that non-work-days are added Assert.That(userForecastMonth.Forecasts.Select(x => x.Date).Contains(forecastDate), Is.True); } } }
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)); }