public bool saveDetails() { bool myBool = false; try { int gardenId = int.Parse(cmbGardenName.SelectedValue.ToString()); string gDesc = txtTaskDescription.Text.ToString(); string gNote = txtuserNotes.Text.ToString(); Job newJob = new Job(); newJob.GardenID = gardenId; newJob.Description = this.txtTaskDescription.Text; newJob.DateAssigned = DateTime.Now; newJob.AssignedFrom = accessToken.UserID; newJob.UserNotes = this.txtuserNotes.Text; myBool = jobManager.AddNewTask(newJob); } catch (Exception ax) { MessageBox.Show(ax.Message); } return(myBool); }
public void TestInsertData() { Job job = new Job(); // arrange job.JobID = 1000; job.GardenID = 1000; job.Description = "Gardening"; job.DateAssigned = new DateTime(1998, 04, 30); job.DateCompleted = new DateTime(1998, 04, 30); job.AssignedTo = 1000; job.AssignedFrom = 1000; job.UserNotes = "Gardening is done!"; job.Active = true; // act bool result = jobManager.AddNewTask(job); // assert Assert.AreEqual(result, true); }