コード例 #1
0
 public void AddChild()
 {
     //Arrange
     var child = new Child
     {
         Birthday = new DateTime(2015, 1, 1),
         FirstName = "Bob",
         LastName = "Jones"
     };
    
     //Act
     try
     {
         context.Children.Add(child);
         context.SaveChanges();
     }
     catch (Exception ex)
     {
       
     
     }
    
     //Assert
     Assert.IsTrue(RunDatabaseAsserts());
 }
コード例 #2
0
        public void OneDayPart() {
            Child cOne = new Child { FirstName = "c1", Birthday = Infant(), AttendanceRequest = AllMonday() };
            Child cTwo = new Child { FirstName = "c2", Birthday = Infant(), AttendanceRequest = AllMonday() };
            List<Child> children = new List<Child> {cOne, cTwo};
            Caregiver pOne = new Parent { FirstName = "p1", AvailableAttendance = new List<CaregiverAvailability> { new CaregiverAvailability(DayPart.MONDAY_MORNING) }, Children = new List<Child> { cOne } };
            Caregiver pTwo = new Parent { FirstName = "p2", AvailableAttendance = new List<CaregiverAvailability> { new CaregiverAvailability(DayPart.MONDAY_AFTERNOON) }, Children = new List<Child> { cTwo } };
            List<Caregiver> caregivers = new List<Caregiver> { pOne, pTwo };

            WeekRoster roster = new AutoRosterer().getRoster(caregivers, children);
            Console.WriteLine(roster);
        }
コード例 #3
0
        private FIT_RESULT addToRoster(WeekRoster roster, Child currentChild, AttendanceRequest bringWish)
        {
            List<Child> children = roster.getChildren(bringWish.Dayparts);
            List<Caregiver> caregivers = roster.getCaregivers(bringWish.Dayparts);
            if (children.Count >= 13) // TODO: remove magic numbers
                return FIT_RESULT.FULL;
            if (children.Count + 1 - caregivers.Count * 5 > 0) // TODO: remove magic numbers
                return FIT_RESULT.INSUFFICIENT_CAREGIVERS;
            // TODO: max 3 babies

            roster.addChild(bringWish.Dayparts, currentChild);
            return FIT_RESULT.SUCCESS;
        }
コード例 #4
0
 public void addChild(DayPart dayPart, Child child)
 {
     if (!roster.ContainsKey(dayPart))
         roster[dayPart] = new Tuple<List<Caregiver>, List<Child>>(new List<Caregiver>(), new List<Child>());
     roster[dayPart].Item2.Add(child);
 }