public void RandomSolidColor() { var subject = new PatternRandomSolidColor(); var info = new MockLightingInformation { LightCount = 10 }; var random = new Random(0); subject.Reset(info, random); for (int i = 0; i < 10; i++) { Assert.AreEqual(new Color(45, 0, 210), subject[i]); } subject.NextState(random); for (int i = 0; i < 10; i++) { Assert.AreEqual(new Color(45, 0, 210), subject[i]); } }
public override void Begin(ILightingController controller, Random random) { var nextPattern = _patternFactory.GenerateRandom(random); if (_currentPattern != null) { int i = 0; while (i < 10 && _currentPattern.GetType() == typeof(PatternClear) && nextPattern.GetType() == typeof(PatternClear)) { nextPattern = _patternFactory.GenerateRandom(random); i++; } // TODO : Remove this? // NOTE : Temporary implementation to prevent unlit/black colour being used in succession if (i >= 9) { nextPattern = new PatternRandomSolidColor(); } } _currentPattern = nextPattern; _currentTiming = _timingFactory.GenerateRandom(random); _currentAnimation = _animationFactory.GenerateRandom(random); _currentPattern.Reset(controller, random); var totalSteps = _currentAnimation.Begin(controller, _currentPattern, random); _currentTiming.Reset(totalSteps); }