Esempio 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());
        }
Esempio n. 2
0
        public FigureO()
        {
            _color = Const.O;

            _schemes = new Scheme[1];

            _schemes[0] = new Scheme(new[]{"##",
                                           "##"});
        }
Esempio n. 3
0
        public FigureI()
        {
            _color = Const.I;

            _schemes = new Scheme[2];
            _schemes[0] = new Scheme(new[]{"#",
                                           "#",
                                           "#",
                                           "#"});

            _schemes[1] = new Scheme(new[] { "####" });
        }
Esempio n. 4
0
        public FigureS()
        {
            _color = Const.S;

            _schemes = new Scheme[2];

            _schemes[0] = new Scheme(new[] { "#.",
                                             "##",
                                             ".#" });

            _schemes[1] = new Scheme(new[] { ".##",
                                             "##." });
        }
Esempio n. 5
0
        public void GetHeightTest()
        {
            string[] model = { ".#", "##", "#." };
            var target = new Scheme(model);
            Assert.AreEqual(3, target.GetHeight());

            model = new[] { "####" };
            target = new Scheme(model);
            Assert.AreEqual(1, target.GetHeight());

            model = new[] { "#", "#", "#", "#" };
            target = new Scheme(model);
            Assert.AreEqual(4, target.GetHeight());
        }
Esempio n. 6
0
        public FigureL()
        {
            _color = Const.L;

            _schemes = new Scheme[4];

            _schemes[0] = new Scheme(new[] { "#.",
                                             "#.",
                                             "##" });

            _schemes[1] = new Scheme(new[] { "###",
                                             "#.." });

            _schemes[2] = new Scheme(new[] { "##",
                                             ".#",
                                             ".#" });

            _schemes[3] = new Scheme(new[] { "..#",
                                             "###" });
        }
Esempio n. 7
0
        public void EqualsTest()
        {
            string[] modelTarget = {"##", ".#", ".#"};
            string[] modelObj = { "##", ".#", ".#" };
            var target = new Scheme(modelTarget);
            var obj = new Scheme(modelObj);
            Assert.IsTrue( target.Equals(obj) );

            modelTarget = new[] { "#" };
            modelObj = new[] { "#" };
            target = new Scheme(modelTarget);
            obj = new Scheme(modelObj);
            Assert.IsTrue(target.Equals(obj));

            modelTarget = new[] { "#", "#", "#", "#" };
            modelObj = new[] { "#", "#", "#", "#" };
            target = new Scheme(modelTarget);
            obj = new Scheme(modelObj);
            Assert.IsTrue(target.Equals(obj));
        }
Esempio n. 8
0
 private Scheme(Scheme original)
 {
     model = (bool[][]) original.model.Clone();
 }
Esempio n. 9
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());
        }