public void ThrowException_WhenConflictingActivity()
        {
            var schedule         = Setup();
            var existingActivity = new Activity(
                schedule.Date,
                schedule.Date.AddHours(1),
                "dance",
                "do the dance",
                ActivityType.Exercise);

            schedule.Activities.Add(existingActivity);


            var newActivity = new Activity(
                schedule.Date,
                schedule.Date.AddHours(1),
                "fly",
                "do the fly",
                ActivityType.Exercise);

            Assert.Throws <ValidationException>(() => SetupScheduleValidator.CheckNewActivityDoesNotConflict(schedule, newActivity));
        }
        public void AllowNonConflictingActivity()
        {
            var schedule         = Setup();
            var existingActivity = new Activity(
                schedule.Date,
                schedule.Date.AddHours(1),
                "dance",
                "do the dance",
                ActivityType.Exercise);

            schedule.Activities.Add(existingActivity);


            var newActivity = new Activity(
                schedule.Date.AddHours(2),
                schedule.Date.AddHours(3),
                "fly",
                "do the fly",
                ActivityType.Exercise);

            SetupScheduleValidator.CheckNewActivityDoesNotConflict(schedule, newActivity);
        }
Exemplo n.º 3
0
 public void AddActivityToDailySchedule(DaySchedule schedule, Activity activity)
 {
     SetupScheduleValidator.CheckNewActivityDoesNotConflict(schedule, activity);
     schedule.Activities.Add(activity);
 }