/// <summary> /// Assert the expected data table with a result of 11 lights row. /// </summary> /// <param name="tableRow">Expected data row</param> /// <param name="row11LightsModel">Result of 11 lights row</param> public static void AssertLights(this TableRow tableRow, Row11LightsModel row11LightsModel) { bool expectedLight1 = bool.Parse(tableRow["Light1"]); bool expectedLight2 = bool.Parse(tableRow["Light2"]); bool expectedLight3 = bool.Parse(tableRow["Light3"]); bool expectedLight4 = bool.Parse(tableRow["Light4"]); bool expectedLight5 = bool.Parse(tableRow["Light5"]); bool expectedLight6 = bool.Parse(tableRow["Light6"]); bool expectedLight7 = bool.Parse(tableRow["Light7"]); bool expectedLight8 = bool.Parse(tableRow["Light8"]); bool expectedLight9 = bool.Parse(tableRow["Light9"]); bool expectedLight10 = bool.Parse(tableRow["Light10"]); bool expectedLight11 = bool.Parse(tableRow["Light11"]); Assert.IsNotNull(row11LightsModel, "The 11 lights model should be not null."); Assert.AreEqual(expectedLight1, row11LightsModel.Light1, string.Format(_errorMessage, 1, expectedLight1, row11LightsModel.Light1)); Assert.AreEqual(expectedLight2, row11LightsModel.Light2, string.Format(_errorMessage, 2, expectedLight2, row11LightsModel.Light2)); Assert.AreEqual(expectedLight3, row11LightsModel.Light3, string.Format(_errorMessage, 3, expectedLight3, row11LightsModel.Light3)); Assert.AreEqual(expectedLight4, row11LightsModel.Light4, string.Format(_errorMessage, 4, expectedLight4, row11LightsModel.Light4)); Assert.AreEqual(expectedLight5, row11LightsModel.Light5, string.Format(_errorMessage, 5, expectedLight5, row11LightsModel.Light5)); Assert.AreEqual(expectedLight6, row11LightsModel.Light6, string.Format(_errorMessage, 6, expectedLight6, row11LightsModel.Light6)); Assert.AreEqual(expectedLight7, row11LightsModel.Light7, string.Format(_errorMessage, 7, expectedLight7, row11LightsModel.Light7)); Assert.AreEqual(expectedLight8, row11LightsModel.Light8, string.Format(_errorMessage, 8, expectedLight8, row11LightsModel.Light8)); Assert.AreEqual(expectedLight9, row11LightsModel.Light9, string.Format(_errorMessage, 9, expectedLight9, row11LightsModel.Light9)); Assert.AreEqual(expectedLight10, row11LightsModel.Light10, string.Format(_errorMessage, 10, expectedLight10, row11LightsModel.Light10)); Assert.AreEqual(expectedLight11, row11LightsModel.Light11, string.Format(_errorMessage, 11, expectedLight11, row11LightsModel.Light11)); }
public void GivenISubscribeToTheRowEvents() { _berlinClockApi.OnRow5HoursChanged += (x) => _row5Hours = x; _berlinClockApi.OnRow1HourChanged += (x) => _row1Hour = x; _berlinClockApi.OnRow5MinutesChanged += (x) => _row5Minutes = x; _berlinClockApi.OnRow1MinuteChanged += (x) => _row1Minute = x; }
public void GivenIImplementTheThirdRowOfTheBerlinClock() { _row5Minutes = new Row5Minutes(); _row5Minutes.OnRowChanged += (x) => _results = x; }
/// <summary> /// Method triggered when the third row value changed. /// </summary> /// <param name="row5m">Updated parameters</param> private void Row5MinutesChange(Row11LightsModel row5m) => this.Set11Lights(this.R5m1, this.R5m2, this.R5m3, this.R5m4, this.R5m5, this.R5m6, this.R5m7, this.R5m8, this.R5m9, this.R5m10, this.R5m11, row5m);
/// <summary> /// Set the UI element for a row of 11 lights with the values of the model "Row11LightsModel". /// </summary> private void Set11Lights(UIElement r1, UIElement r2, UIElement r3, UIElement r4, UIElement r5, UIElement r6, UIElement r7, UIElement r8, UIElement r9, UIElement r10, UIElement r11, Row11LightsModel values) => _dispatcher.Invoke(() => { r1.SetShapeOpacity(values.Light1); r2.SetShapeOpacity(values.Light2); r3.SetShapeOpacity(values.Light3); r4.SetShapeOpacity(values.Light4); r5.SetShapeOpacity(values.Light5); r6.SetShapeOpacity(values.Light6); r7.SetShapeOpacity(values.Light7); r8.SetShapeOpacity(values.Light8); r9.SetShapeOpacity(values.Light9); r10.SetShapeOpacity(values.Light10); r11.SetShapeOpacity(values.Light11); });