public void AddEntry_Test() { // ARRANGE CreateSubtask(); var subtask = this.uow.Subtasks.Get(1); var project = this.uow.Projects.Get(1); var entryCreateParam = new EntryCreateParam { Name = "Test entry", Comment = "Test comment", Date = DateTime.Now.Date, Started = DateTime.Now.AddHours(-2), Ended = DateTime.Now.AddHours(-1) }; var subtaskLogic = new SubtaskLogic(); // ACT subtaskLogic.AddEntry(subtask.Id, entryCreateParam); subtaskLogic.Dispose(); this.uow.Dispose(); this.uow = new UnitOfWork(); // ASSERT var inserted = this.uow.Entries.Get(1); Assert.IsNotNull(inserted); Assert.AreEqual(subtask.Id, inserted.Subtask_Id.Value); }
public void CreateEntry() { var projectLogic = new ProjectLogic(); var project = projectLogic.GetProjectById(project_id); projectLogic.Dispose(); var subtaskLogic = new SubtaskLogic(); var subtask = subtaskLogic.GetById(this.SelectedSubtask.Id); ChangeParentAssignmentToInProgress(subtask); var entryCreateViewModel = new EntryCreateViewModel { Comment = this.tb_Description.Text, Date = DateTime.Now, Name = this.tb_Name.Text, Project = project, Subtask = subtask, DurationAsTicks = this.DurationElapsed.Ticks, Ended = this.stopped, Started = this.started }; subtaskLogic.AddEntry(this.SelectedSubtask.Id, entryCreateViewModel, this.chebo_FinishesSubtask.IsChecked.Value); subtaskLogic.Dispose(); this.Close(); }