Case statements do not explicitly handle all enum values

CodeRush Classic shows the Case statements do not explicitly handle all enum values code issue if a switch block does not handle all values of the enum passed as a parameter.

Fix

Add case statements for missing enum elements.

Purpose

Case statements do not explicitly handle all enum values directs your attention to switch blocks, which do not handle all enum elements, because it usually denotes an incomplete code.

Example

public string GetDaySchedule(DayOfWeek day)
{
    switch (day)
    {
        case DayOfWeek.Monday:
            return LoadShedule("MondayShedule.dat");
        case DayOfWeek.Tuesday:
            return LoadShedule("TuesdayShedule.dat");
        case DayOfWeek.Wednesday:
            return LoadShedule("WednesdayShedule.dat");
        case DayOfWeek.Thursday:
            return LoadShedule("ThursdayShedule.dat");
        case DayOfWeek.Friday:
            return LoadShedule("FridayShedule.dat");
        default:
            return string.Empty;
    }
}

Fix:

public string GetDaySchedule(DayOfWeek day)
{
    switch (day)
    {
        case DayOfWeek.Monday:
            return LoadShedule("MondayShedule.dat");
        case DayOfWeek.Tuesday:
            return LoadShedule("TuesdayShedule.dat");
        case DayOfWeek.Wednesday:
            return LoadShedule("WednesdayShedule.dat");
        case DayOfWeek.Thursday:
            return LoadShedule("ThursdayShedule.dat");
        case DayOfWeek.Friday:
            return LoadShedule("FridayShedule.dat");
        case DayOfWeek.Saturday:
            return "day off";
        case DayOfWeek.Sunday:
            return "day off";
        default:
            return string.Empty;
    }
}