private void CreateForecastWithSingleProjectRegistration(ForecastMonth month, DateTime date, ForecastType forecastType, Project project, decimal hours, decimal?dedicatedHours = null) { var forecast = month.AddForecast(date, forecastType, dedicatedHours); if (forecastType.SupportsProjectHours) { forecast.AddProjectRegistration(project, hours); } }
public void AddForecast_ForecastDateIsNotPartOfForecastMonth_ThrowsException(string dateString, string message) { // Arrange Fixture.Behaviors.Add(new OmitOnRecursionBehavior()); var usr = Fixture .Build <User>() .Without(x => x.ForecastMonths) .Create(); var forecastType = Fixture.Create <ForecastType>(); var month = new ForecastMonth(1, 2013, 3, usr, usr); // Act var exp = Assert.Throws <Exception>(() => month.AddForecast(ParseDkDateString(dateString), forecastType, null)); // Assert Assert.That(exp.Message, Is.EqualTo(message)); }
public void AddForecast_AddsNewForecastToCollection() { // Arrange Fixture.Behaviors.Add(new OmitOnRecursionBehavior()); var usr = Fixture .Build <User>() .Without(x => x.ForecastMonths) .Create(); var forecastType = Fixture.Create <ForecastType>(); var month = new ForecastMonth(1, 2013, 3, usr, usr); // Act month.AddForecast(new DateTime(2013, 1, 1), forecastType, null); // Assert var forecast = month.Forecasts.Single(); Assert.That(forecast.Date, Is.EqualTo(new DateTime(2013, 1, 1))); Assert.That(forecast.ForecastType, Is.EqualTo(forecastType)); Assert.That(forecast.DedicatedForecastTypeHours, Is.EqualTo(null)); }