예제 #1
0
        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);
        }
예제 #2
0
        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));
        }
예제 #3
0
        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);
        }