Exemple #1
0
        public void PredictDigits_WhenAllSectionsAreServiceable_ShouldReturnSingle()
        {
            var predictor = new DigitPredictor(new BrokenSectionsExpert());

            var trafficLight = new Light(Color.Green, new TrafficLightDigits(Constants.Zero, new Digit(02)));

            var observation = new Observation(Guid.NewGuid(), new Light(Color.Green, new TrafficLightDigits(88)), null);

            var result = predictor
                         .Predict(trafficLight, new[] { observation })
                         .ToArray();

            Assert.Single(result);
            Assert.Equal(new TrafficLightDigits(02), result[0]);
        }
Exemple #2
0
        public void PredictDigits_WithoutPreviousObservations()
        {
            var predictor = new DigitPredictor(new BrokenSectionsExpert());

            var trafficLight = new Light(Color.Green, new TrafficLightDigits(Constants.Zero, new Digit("0011101")));

            var result = predictor
                         .Predict(trafficLight, new Observation[0])
                         .ToArray();

            Assert.Contains(new TrafficLightDigits(02), result);
            Assert.Contains(new TrafficLightDigits(08), result);
            Assert.Contains(new TrafficLightDigits(82), result);
            Assert.Contains(new TrafficLightDigits(88), result);
        }