Example #1
0
 public void TestResourceHas300Commands()
 {
     var show = new LightShow();
     using (var stream = CreateResource())
     {
         var textStream = InputReader.ReadResource(stream);
         var commands = show.CreateCommands(new Tokenizer().Tokenize(textStream));
         Assert.AreEqual(300, commands.ToList().Count);
     }
 }
Example #2
0
        public void LitDiodsAre400410()
        {
            var show = new LightShow();
            using (var stream = CreateResource())
            {
                var textStream = InputReader.ReadResource(stream);
                var commands = show.CreateCommands(new Tokenizer().Tokenize(textStream));

                var grid = new LightGrid<LightDiod>(1000, 1000, () => new LightDiod(false));
                foreach (var command in commands)
                {
                    grid.Execute(command);
                }

                Assert.AreEqual(400410, grid.GetDiods().Count(x => x.Item2.On));
            }
        }
Example #3
0
        public void BrightnessIs15343601()
        {
            var show = new LightShow();
            using (var stream = CreateResource())
            {
                var textStream = InputReader.ReadResource(stream);
                var commands = show.CreateCommands(new Tokenizer().Tokenize(textStream));

                var grid = new LightGrid<DimmedLightDiod>(1000, 1000, () => new DimmedLightDiod(0));

                foreach (var command in commands)
                {
                    grid.Execute(command);
                }

                Assert.AreEqual(15343601, grid.GetDiods().Sum(x => x.Item2.Brightness));
            }
        }