public void CreateRegistrationsFromHeaders_DateHeadersHasTwoItems_ReturnsTwoHourRegistrations() { // Arrange var frame = new DispatcherFrame(); var dateHeaders = new List <ForecastRegistrationDateColumn>() { new ForecastRegistrationDateColumn(new DateTime(2013, 1, 1)), new ForecastRegistrationDateColumn(new DateTime(2013, 1, 2)) }; var viewModel = new Mock <IForecastRegistrationViewModel>(); viewModel.SetupGet(x => x.PresenceRegistrations).Returns(new ObservableCollection <ForecastTypeRegistration>( dateHeaders.Select(x => { var newItem = new ForecastTypeRegistration(ForecastTestData.ProjectHoursOnlyForecastType, null); x.ForecastTypeRegistration = newItem; return(newItem); }).ToList() )); var clientReg = new ProjectRegistration(); var generator = new ForecastRegistrationDataGenerator(null, null, null); // Act var result = generator.CreateProjectHoursFromHeaders(dateHeaders, viewModel.Object, clientReg); // Assert Assert.That(result.Count, Is.EqualTo(2)); Assert.That(result.Any(x => x.Hours != 0), Is.False); Assert.That(result.Any(x => !x.Parent.Equals(clientReg)), Is.False); }
public ProjectRegistration AddNewProjectRegistration(int projectId, string projectName, string companyName) { var project = new ProjectRegistration { ProjectId = projectId, ProjectName = projectName, ComapyName = companyName }; project.Registrations = _forecastRegistrationDataGenerator.CreateProjectHoursFromHeaders(DateColumns, this, project); ProjectRegistrations.Add(project); CalculateTotals(); return(project); }