public void ModifyActivity(object selectedObject, string name, int cost, DateTime date) { ActivityLogic logic = new ActivityLogic(); Activity newActivity = new Activity(); Activity oldActivity = (Activity)selectedObject; newActivity.Id = oldActivity.Id; newActivity.Name = name; newActivity.Cost = cost; newActivity.Date = date; logic.Modify(selectedObject, newActivity); }
public void ModifyStudentFailCheckOldActivity() { SetUp(); ActivityLogic testLogic = new ActivityLogic(); Activity newActivity = testActivity(); Activity anotherActivity = testActivity(); anotherActivity.Name = ""; anotherActivity.Cost = -3; testLogic.Add(newActivity); newActivity.Id = GetLastActivityInDB().Id; testLogic.Modify(newActivity, anotherActivity); Assert.IsTrue(testLogic.Exists(newActivity)); }
public void ModifyActivitySuccess() { SetUp(); ActivityLogic testLogic = new ActivityLogic(); Activity newActivity = testActivity(); Activity anotherActivity = testActivity(); string testName = "newName"; anotherActivity.Name = testName; testLogic.Add(newActivity); anotherActivity.Id = GetLastActivityInDB().Id; testLogic.Modify(newActivity, anotherActivity); List <Activity> list = testLogic.GetAllActivities(); bool validation = false; if (list.Count != 0) { validation = (list.ElementAt(0).Name == anotherActivity.Name); } Assert.IsTrue(validation); }