/// <summary> /// یک Extension Method برای State, برای تبدیل State به Boolean /// </summary> /// <param name="value">یک مقدار از State</param> /// <returns>bool</returns> public static bool ToBoolean(this WorkSchedule.State value) { switch (value) { case WorkSchedule.State.Work: return(true); case WorkSchedule.State.Off: return(false); default: throw new ArgumentOutOfRangeException("value"); } }
public bool ToBoolean_WithValidInput_ReturnsExpectedOutput(WorkSchedule.State state) { return(state.ToBoolean()); }