Exemplo n.º 1
0
        public void TestFigureI()
        {
            figure = new FigureI();
            var schemePhase1 = new Scheme(new[] { "#", "#", "#", "#" });
            var schemePhase2 = new Scheme(new[] { "####" });

            Assert.AreEqual(schemePhase1, figure.GetScheme());
            Assert.AreEqual(1, figure.GetWidth());
            Assert.AreEqual(4, figure.GetHeight());

            figure.Rotate();
            Assert.AreEqual(schemePhase2, figure.GetScheme());
            Assert.AreEqual(4, figure.GetWidth());
            Assert.AreEqual(1, figure.GetHeight());

            figure.Rotate();
            Assert.AreEqual(schemePhase1, figure.GetScheme());
            Assert.AreEqual(1, figure.GetWidth());
            Assert.AreEqual(4, figure.GetHeight());

            figure.Rotate();
            Assert.AreEqual(schemePhase2, figure.GetScheme());
            Assert.AreEqual(4, figure.GetWidth());
            Assert.AreEqual(1, figure.GetHeight());
        }
Exemplo n.º 2
0
        public void TestFigureJ()
        {
            figure = new FigureJ();

            var schemePhase1 = new Scheme(new[] {".#", ".#", "##"} );
            var schemePhase2 = new Scheme(new[] { "#..", "###"} );
            var schemePhase3 = new Scheme(new[] { "##", "#.", "#." } );
            var schemePhase4 = new Scheme(new[] { "###", "..#" } );

            Assert.AreEqual(schemePhase1, figure.GetScheme());
            Assert.AreEqual(2, figure.GetWidth());
            Assert.AreEqual(3, figure.GetHeight());

            figure.Rotate();
            Assert.AreEqual(schemePhase2, figure.GetScheme());
            Assert.AreEqual(3, figure.GetWidth());
            Assert.AreEqual(2, figure.GetHeight());

            figure.Rotate();
            Assert.AreEqual(schemePhase3, figure.GetScheme());
            Assert.AreEqual(2, figure.GetWidth());
            Assert.AreEqual(3, figure.GetHeight());

            figure.Rotate();
            Assert.AreEqual(schemePhase4, figure.GetScheme());
            Assert.AreEqual(3, figure.GetWidth());
            Assert.AreEqual(2, figure.GetHeight());

            figure.Rotate();
            Assert.AreEqual(schemePhase1, figure.GetScheme());
            Assert.AreEqual(2, figure.GetWidth());
            Assert.AreEqual(3, figure.GetHeight());
        }