public void Schedule_merge_renovation_valid() { RenovationService renovationService = SetupRenovationService(); MergeRenovation result = renovationService.AddMergeRenovation(_createRenovaton.CreateValidTestObjectForSchedulingMergeRenovation()); Assert.Equal(result.Description, _createRenovaton.CreateValidTestObjectForSchedulingMergeRenovation().Description); }
public void Schedule_merge_renovation_return_null() { RenovationService renovationService = SetupRenovationService(); MergeRenovation result = renovationService.AddMergeRenovation(_createRenovaton.CreateInvalidTestObjectForSchedulingMergeRenovation()); Assert.Null(result); }
private DateTime FindLastAppointmentFromBothRooms(MergeRenovation renovation) { DateTime appointmentInFirstRoom = FindLastAppointmentForSignleRoom(renovation.RoomId); DateTime appointmentInSecondRoom = FindLastAppointmentForSecondRoom(renovation.SecondRoomId); return(appointmentInFirstRoom.CompareTo(appointmentInSecondRoom) > 0 ? appointmentInFirstRoom : appointmentInFirstRoom); }
public List <RenovationPeriod> GetMergeRenovationAlternativeAppointmets(MergeRenovation renovation) { renovation.RenovationPeriod.BeginDate = SetNewDateTimesForRenovation(renovation.RenovationPeriod.BeginDate); renovation.RenovationPeriod.EndDate = SetNewDateTimesForRenovation(renovation.RenovationPeriod.EndDate); DateTime lastAppointment = FindLastAppointmentFromBothRooms(renovation); return(GetRenovationAlternativeAppointmets(renovation, lastAppointment)); }
public ActionResult AddMergeRenovation(MergeRenovationDTO mergeRenovationDTO) { MergeRenovation addedBaseRenovation = (MergeRenovation)_renovationService.AddMergeRenovation(MergeRenovationMapper.MergeRenovationDTOToMergeRenovation(mergeRenovationDTO)); if (addedBaseRenovation == null) { return(NotFound("NotFound")); } return(Ok()); }
public MergeRenovation AddMergeRenovation(MergeRenovation renovation) { renovation.RenovationPeriod.BeginDate = SetNewDateTimesForRenovation(renovation.RenovationPeriod.BeginDate); renovation.RenovationPeriod.EndDate = SetNewDateTimesForRenovation(renovation.RenovationPeriod.EndDate); DateTime lastAppointment = FindLastAppointmentFromBothRooms(renovation); if (lastAppointment.CompareTo(renovation.RenovationPeriod.BeginDate) >= 0) { return(null); } _equipmentTransferRepository.AddEquipmentTransfer(new EquipmentTransfer(renovation.RoomId, renovation.RenovationPeriod.BeginDate)); _equipmentTransferRepository.AddEquipmentTransfer(new EquipmentTransfer(renovation.SecondRoomId, renovation.RenovationPeriod.BeginDate)); _renovationRepository.AddRenovation(renovation); return(renovation); }