Example #1
0
        public void GivenParamsWhenMazeConstructedItCreatesCorrectNumberOfMirrors()
        {
            var mazeParams = new MazeParams()
            {
                Length  = 5,
                Width   = 4,
                Mirrors = new List <MetaPosition>()
                {
                    new MetaPosition(new Position(0, 0), "L"),
                    new MetaPosition(new Position(0, 0), "L"),
                    new MetaPosition(new Position(0, 0), "L"),
                    new MetaPosition(new Position(0, 0), "R"),
                    new MetaPosition(new Position(0, 0), "R"),
                    new MetaPosition(new Position(0, 0), "RL"),
                    new MetaPosition(new Position(0, 0), "RR"),
                    new MetaPosition(new Position(0, 0), "LL"),
                    new MetaPosition(new Position(0, 0), "LR")
                }
            };
            var fakeMirrorFactory = new FakeMirrorFactory();

            var maze = new Maze(mazeParams, fakeMirrorFactory);

            AssertMirrorCount(mazeParams, fakeMirrorFactory);
            AssertSpecialMirrorCounts(fakeMirrorFactory);
        }
Example #2
0
 private void AssertSpecialMirrorCounts(FakeMirrorFactory factory)
 {
     Assert.AreEqual(3, factory.TwoWayLeftMirrorCount);
     Assert.AreEqual(2, factory.TwoWayRightMirrorCount);
     Assert.AreEqual(1, factory.OneWayRightReflectRightMirrorCount);
     Assert.AreEqual(1, factory.OneWayRightReflectLeftMirrorCount);
     Assert.AreEqual(1, factory.OneWayLeftReflectRightMirrorCount);
     Assert.AreEqual(1, factory.OneWayLeftReflectLeftMirrorCount);
 }
Example #3
0
        private void AssertMirrorCount(MazeParams mazeParams, FakeMirrorFactory factory)
        {
            var expectedNumberOfMirrors = mazeParams.Length * mazeParams.Width + mazeParams.Mirrors.Count;

            Assert.AreEqual(expectedNumberOfMirrors, factory.MirrorCount);
        }