Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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));
        }