public void ChangeProjectTest() { mockRepository.Setup(m => m.Get(It.IsAny <Int32>())).Returns(new Project(1, "test", 1, "sososo", new DateTime(2008, 02, 4), new DateTime(2008, 02, 4))); projectsService.ChangeProject(new ProjectDTO(1, "test2", 3, "sososo", new DateTime(2008, 02, 4), new DateTime(2008, 02, 4))); mockRepository.Verify(m => m.Update(It.IsAny <Project>()), Times.Once); }
private void ChangeButton_Click(object sender, EventArgs e) { foreach (DataGridViewRow r in dataGridView1.SelectedRows) { ProjectDTO project = new ProjectDTO( Convert.ToInt32(dataGridView1[0, r.Index].Value), dataGridView1[1, r.Index].Value.ToString(), Convert.ToInt32(dataGridView1[2, r.Index].Value), dataGridView1[3, r.Index].Value.ToString(), Convert.ToDateTime(dataGridView1[4, r.Index].Value), Convert.ToDateTime(dataGridView1[5, r.Index].Value)); ps.ChangeProject(project); } }