/// <summary> /// Initializes a new instance of the <see cref="TrafficLightRedYellowGreen"/> class width instructions /// </summary> /// <param name="RedLight">Status of color red</param> /// <param name="YellowLight">Status of color yellow</param> /// <param name="GreenLight">Status of color green</param> /// <exception cref="System.ArgumentException"> /// Invalid combination /// </exception> public TrafficLightRedYellowGreen(bool RedLight, bool YellowLight, bool GreenLight) { if (RedLight == true && YellowLight == true && GreenLight == true) { throw new ArgumentException("Invalid combination"); } else if (RedLight == false && YellowLight == true && GreenLight == true) { throw new ArgumentException("Invalid combination"); } else if (RedLight == true && YellowLight == false && GreenLight == true) { throw new ArgumentException("Invalid combination"); } this.RedLight = new Red.Red(RedLight); this.YellowLight = new Yellow.Yellow(YellowLight); this.GreenLight = new Green.Green(GreenLight); }
/// <summary> /// Initializes a new instance of the <see cref="TrafficLightRedYellowGreen"/> class widthout instructions /// </summary> public TrafficLightRedYellowGreen() { RedLight = new Red.Red(); YellowLight = new Yellow.Yellow(); GreenLight = new Green.Green(); }