TEST(LightScheduler, ScheduleWeekEnd) { LightScheduler_ScheduleTurnOn(3, WEEKEND, 1200); FakeTimeService_SetDay(FRIDAY); FakeTimeService_SetMinute(1200); LightScheduler_WakeUp(); TEST_ASSERT_EQUAL(LIGHT_ID_UNKNOWN, LightControllerSpy_GetLastId()); TEST_ASSERT_EQUAL(LIGHT_STATE_UNKNOWN, LightControllerSpy_GetLastState()); FakeTimeService_SetDay(SATURDAY); FakeTimeService_SetMinute(1200); LightScheduler_WakeUp(); TEST_ASSERT_EQUAL(3, LightControllerSpy_GetLastId()); TEST_ASSERT_EQUAL(1, LightControllerSpy_GetLastState()); LightController_TurnOff(3); FakeTimeService_SetDay(SUNDAY); FakeTimeService_SetMinute(1200); LightScheduler_WakeUp(); TEST_ASSERT_EQUAL(3, LightControllerSpy_GetLastId()); TEST_ASSERT_EQUAL(1, LightControllerSpy_GetLastState()); LightController_Create(); FakeTimeService_SetDay(MONDAY); FakeTimeService_SetMinute(1200); LightScheduler_WakeUp(); TEST_ASSERT_EQUAL(LIGHT_ID_UNKNOWN, LightControllerSpy_GetLastId()); TEST_ASSERT_EQUAL(LIGHT_STATE_UNKNOWN, LightControllerSpy_GetLastState()); }
TEST(LightScheduler, ScheduleOnTuesdayAndItsTuesdayAndItsTime) { LightScheduler_ScheduleTurnOn(id, TUESDAY, 100); setTimeTo(TUESDAY, 100); LightScheduler_WakeUp(); checkLightState(id, LIGHT_ON); }
TEST(LightScheduler, ScheduleOnTuesdayAndItsNotTuesdayButItsTime) { LightScheduler_ScheduleTurnOn(id, TUESDAY, 100); setTimeTo(MONDAY, 100); LightScheduler_WakeUp(); checkLightState(LIGHT_ID_UNKNOWN, LIGHT_STATE_UNKNOWN); }
TEST(LightScheduler, ScheduleOnEverydayItsTime) { LightScheduler_ScheduleTurnOn(id, EVERYDAY, scheduledMinute); setTimeTo(SUNDAY, scheduledMinute); LightScheduler_WakeUp(); checkLightState(id, LIGHT_ON); }
TEST(LightScheduler, ScheduleEverydayNotTimeYet) { LightScheduler_ScheduleTurnOn(id, EVERYDAY, 100); setTimeTo(SUNDAY, 1200); LightScheduler_WakeUp(); checkLightState(LIGHT_ID_UNKNOWN, LIGHT_STATE_UNKNOWN); }
TEST(LightScheduler, ScheduleWeekEndItsMonday) { LightScheduler_ScheduleTurnOn(3, WEEKEND, 1200); setTimeTo(MONDAY, 1200); LightScheduler_WakeUp(); checkLightState(LIGHT_ID_UNKNOWN, LIGHT_STATE_UNKNOWN); }
TEST(LightScheduler, ScheduleWeekEndItsSunday) { LightScheduler_ScheduleTurnOn(3, WEEKEND, 1200); setTimeTo(SUNDAY, 1200); LightScheduler_WakeUp(); checkLightState(3, LIGHT_ON); }
TEST(LightScheduler, ScheduleTuesdayAndItsTuesday) { LightScheduler_ScheduleTurnOn(3, TUESDAY, 1200); setTimeTo(TUESDAY, 1200); LightScheduler_WakeUp(); checkLightState(3, LIGHT_ON); }
TEST(LightScheduler, ScheduleOffTuesdayAndItsTuesdayAndItsTime) { LightScheduler_ScheduleTurnOff(id, TUESDAY, 200); setTimeTo(TUESDAY, 200); LightScheduler_WakeUp(); checkLightState(id, LIGHT_OFF); }
TEST(LightScheduler, ScheduleOffWeekendAndItsSaturdayAndItsTime) { LightScheduler_ScheduleTurnOff(id, WEEKEND, 200); setTimeTo(SATURDAY, 200); LightScheduler_WakeUp(); checkLightState(id, LIGHT_OFF); }
TEST(LightScheduler, ScheduleTuesdayButItsMonday) { LightScheduler_ScheduleTurnOn(3, TUESDAY, 1200); setTimeTo(MONDAY, 1200); LightScheduler_WakeUp(); checkLightState(LIGHT_ID_UNKNOWN, LIGHT_STATE_UNKNOWN); }
TEST(LightScheduler, ScheduleOnWeekdayAndItsSaturdayAndItsTime) { LightScheduler_ScheduleTurnOn(id, WEEKDAY, 1000); setTimeTo(SATURDAY, 1000); LightScheduler_WakeUp(); checkLightState(LIGHT_ID_UNKNOWN, LIGHT_STATE_UNKNOWN); }
TEST(LightScheduler, ScheduleOnWeekdayAndItsFridayAndItsTime) { LightScheduler_ScheduleTurnOn(id, WEEKDAY, 1000); setTimeTo(FRIDAY, 1000); LightScheduler_WakeUp(); checkLightState(id, LIGHT_ON); }
TEST(LightScheduler, ScheduleOnWeekendAndItsMondayAndItsTime) { LightScheduler_ScheduleTurnOn(id, WEEKEND, 100); setTimeTo(MONDAY, 100); LightScheduler_WakeUp(); checkLightState(id, LIGHT_STATE_UNKNOWN); }
TEST(LightScheduler, ScheduleOnWeekendAndItsSundayAndItsTime) { LightScheduler_ScheduleTurnOn(id, WEEKEND, 100); setTimeTo(SUNDAY, 100); LightScheduler_WakeUp(); checkLightState(id, LIGHT_ON); }
TEST(LightScheduler, RemoveScheduledEvent) { LightScheduler_ScheduleTurnOn(6, MONDAY, 600); LightScheduler_ScheduleRemove(6, MONDAY, 600); setTimeTo(MONDAY, 599); LightScheduler_WakeUp(); checkLightState(LIGHT_ID_UNKNOWN, LIGHT_STATE_UNKNOWN); }
TEST(LightScheduler, ScheduleOnTodayNotTimeYet) { LightScheduler_ScheduleTurnOn(3, EVERYDAY, 1200); FakeTimeService_SetMinute(1199); LightScheduler_WakeUp(); TEST_ASSERT_EQUAL(LIGHT_ID_UNKNOWN, LightControllerSpy_GetLastId()); TEST_ASSERT_EQUAL(LIGHT_STATE_UNKNOWN, LightControllerSpy_GetLastState()); }
TEST(LightScheduler, ScheduleOnEverydayItsTime) { LightScheduler_ScheduleTurnOn(id, EVERYDAY, 200); FakeTimeService_SetMinute(200); FakeTimeService_SetDay(MONDAY); LightScheduler_WakeUp(); TEST_ASSERT_EQUAL(id, LightControllerSpy_GetLastId()); TEST_ASSERT_EQUAL(LIGHT_ON, LightControllerSpy_GetLastState()); }
TEST(LightScheduler, WeekdayScheduleIsOperatedOnMonday) { LightScheduler_ScheduleTurnOn(3, WEEKDAY, 1200); FakeTimeService_SetDay(MONDAY); FakeTimeService_SetMinute(1200); LightScheduler_WakeUp(); TEST_ASSERT_EQUAL(3, LightControllerSpy_GetLastId()); TEST_ASSERT_EQUAL(LIGHT_ON, LightControllerSpy_GetLastState()); }
TEST(LightScheduler, ScheduleOffTuesdayAndItsTuesdayAndItsTime) { LightScheduler_ScheduleTurnOff(id, TUESDAY, 200); FakeTimeService_SetMinute(200); FakeTimeService_SetDay(TUESDAY); LightScheduler_WakeUp(); TEST_ASSERT_EQUAL(id, LightControllerSpy_GetLastId()); TEST_ASSERT_EQUAL(LIGHT_OFF, LightControllerSpy_GetLastState()); }
TEST(LightScheduler, WeekdayScheduleNotOperatedOnSunday) { LightScheduler_ScheduleTurnOn(3, WEEKDAY, 1200); FakeTimeService_SetDay(SUNDAY); FakeTimeService_SetMinute(1200); LightScheduler_WakeUp(); TEST_ASSERT_EQUAL(LIGHT_ID_UNKNOWN, LightControllerSpy_GetLastId()); TEST_ASSERT_EQUAL(LIGHT_STATE_UNKNOWN, LightControllerSpy_GetLastState()); }
TEST(LightScheduler, ScheduleWeekEndItsMonday) { LightScheduler_ScheduleTurnOn(3, WEEKEND, 1200); FakeTimeService_SetDay(MONDAY); FakeTimeService_SetMinute(1200); LightScheduler_WakeUp(); TEST_ASSERT_EQUAL(LIGHT_ID_UNKNOWN, LightControllerSpy_GetLastId()); TEST_ASSERT_EQUAL(LIGHT_STATE_UNKNOWN, LightControllerSpy_GetLastState()); }
TEST(LightScheduler, ScheduleWeekEndItsSunday) { LightScheduler_ScheduleTurnOn(6, WEEKEND, 1200); FakeTimeService_SetDay(SUNDAY); FakeTimeService_SetMinute(1200); LightScheduler_WakeUp(); TEST_ASSERT_EQUAL(6, LightControllerSpy_GetLastId()); TEST_ASSERT_EQUAL(1, LightControllerSpy_GetLastState()); }
TEST(LightScheduler, MultipleScheduledEventsDifferentTimes) { LightScheduler_ScheduleTurnOff(4, MONDAY, 600); LightScheduler_ScheduleTurnOn(3, MONDAY, 500); FakeTimeService_SetDay(MONDAY); FakeTimeService_SetMinute(500); LightScheduler_WakeUp(); TEST_ASSERT_EQUAL(3, LightControllerSpy_GetLastId()); TEST_ASSERT_EQUAL(LIGHT_ON, LightControllerSpy_GetLastState()); FakeTimeService_SetMinute(600); LightScheduler_WakeUp(); TEST_ASSERT_EQUAL(4, LightControllerSpy_GetLastId()); TEST_ASSERT_EQUAL(LIGHT_OFF, LightControllerSpy_GetLastState()); }
TEST(LightScheduler, NoScheduleNothingHappens) { FakeTimeService_SetDay(MONDAY); FakeTimeService_SetMinute(100); LightScheduler_WakeUp(); TEST_ASSERT_EQUAL(LIGHT_ID_UNKNOWN, LightControllerSpy_GetLastId()); TEST_ASSERT_EQUAL(LIGHT_STATE_UNKNOWN, LightControllerSpy_GetLastState()); }
TEST(LightScheduler, ScheduleEverydayNotTimeYet) { LightScheduler_ScheduleTurnOn(id, EVERYDAY, 100); FakeTimeService_SetMinute(99); FakeTimeService_SetDay(MONDAY); LightScheduler_WakeUp(); TEST_ASSERT_EQUAL(LIGHT_ID_UNKNOWN, LightControllerSpy_GetLastId()); TEST_ASSERT_EQUAL(LIGHT_STATE_UNKNOWN, LightControllerSpy_GetLastState()); }
TEST(LightScheduler, ScheduleOnTuesdayAndItsNotTuesdayButItsTime) { LightScheduler_ScheduleTurnOn(id, TUESDAY, 100); FakeTimeService_SetMinute(100); FakeTimeService_SetDay(MONDAY); LightScheduler_WakeUp(); TEST_ASSERT_EQUAL(LIGHT_ID_UNKNOWN, LightControllerSpy_GetLastId()); TEST_ASSERT_EQUAL(LIGHT_STATE_UNKNOWN, LightControllerSpy_GetLastState()); }
TEST(LightScheduler, ScheduleOnWeekdayAndItsSaturdayAndItsTime) { LightScheduler_ScheduleTurnOn(id, WEEKDAY, 1000); FakeTimeService_SetMinute(1000); FakeTimeService_SetDay(SATURDAY); LightScheduler_WakeUp(); TEST_ASSERT_EQUAL(LIGHT_ID_UNKNOWN, LightControllerSpy_GetLastId()); TEST_ASSERT_EQUAL(LIGHT_STATE_UNKNOWN, LightControllerSpy_GetLastState()); }
TEST(LightScheduler, ScheduleOnWeekdayAndItsFridayAndItsTime) { LightScheduler_ScheduleTurnOn(id, WEEKDAY, 1000); FakeTimeService_SetMinute(1000); FakeTimeService_SetDay(FRIDAY); LightScheduler_WakeUp(); TEST_ASSERT_EQUAL(id, LightControllerSpy_GetLastId()); TEST_ASSERT_EQUAL(LIGHT_ON, LightControllerSpy_GetLastState()); }
TEST(LightScheduler, ScheduleOffWeekendAndItsSaturdayAndItsTime) { LightScheduler_ScheduleTurnOff(id, WEEKEND, 200); FakeTimeService_SetMinute(200); FakeTimeService_SetDay(SATURDAY); LightScheduler_WakeUp(); TEST_ASSERT_EQUAL(id, LightControllerSpy_GetLastId()); TEST_ASSERT_EQUAL(LIGHT_OFF, LightControllerSpy_GetLastState()); }