public static LightsGrid Get5x5LightsGrid(LightStateType lightState) { var retVal = new LightsGrid(); retVal.Lights = new List <List <Light> > { Get5Lights(lightState), Get5Lights(lightState), Get5Lights(lightState), Get5Lights(lightState), Get5Lights(lightState) }; return(retVal); }
private LightStateType ToggleLightState(LightStateType lightState) { switch (lightState) { case LightStateType.Off: return(LightStateType.On); case LightStateType.On: return(LightStateType.Off); default: throw new NotImplementedException(); } }
private static List <Light> Get5Lights(LightStateType lightState) { return(new List <Light> { new Light { LightState = lightState }, new Light { LightState = lightState }, new Light { LightState = lightState }, new Light { LightState = lightState }, new Light { LightState = lightState } }); }
private int GetCountOfLightsWithState(LightsGrid lightsGrid, LightStateType lightState) { return(lightsGrid.Lights .SelectMany(x => x) .Count(x => x.LightState == lightState)); }