ItEr26S07CUAsignacionGrupoRecursosAPlanificacionItEr25S07: ResourcesPerDayUnit can be converted to hours given the hours of the working day

This commit is contained in:
Óscar González Fernández 2009-09-14 13:19:11 +02:00
parent 54a8922311
commit e89d431fdd
3 changed files with 12 additions and 2 deletions

View file

@ -130,7 +130,7 @@ public class GenericResourceAllocation extends ResourceAllocation {
}
Integer workableHours = SameWorkHoursEveryDay
.getDefaultWorkingDay().getWorkableHours(day);
return resourcesPerDay.getAmount() * workableHours;
return resourcesPerDay.asHoursGivenResourceWorkingDayOf(workableHours);
}
private boolean isTaskFreeDay(LocalDate day) {

View file

@ -8,7 +8,6 @@ public class ResourcePerDayUnit {
public static ResourcePerDayUnit amount(int amount) {
return new ResourcePerDayUnit(amount);
}
private ResourcePerDayUnit(int amount) {
@ -19,4 +18,9 @@ public class ResourcePerDayUnit {
public int getAmount() {
return amount;
}
public int asHoursGivenResourceWorkingDayOf(
Integer resourceWorkingDayHours) {
return getAmount() * resourceWorkingDayHours;
}
}

View file

@ -19,4 +19,10 @@ public class ResourcePerDayUnitTest {
assertThat(units.getAmount(), equalTo(2));
}
@Test
public void canBeConvertedToHoursGivenTheWorkingDayHours() {
ResourcePerDayUnit units = ResourcePerDayUnit.amount(2);
assertThat(units.asHoursGivenResourceWorkingDayOf(8), equalTo(16));
}
}