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()); }
public FigureO() { _color = Const.O; _schemes = new Scheme[1]; _schemes[0] = new Scheme(new[]{"##", "##"}); }
public FigureI() { _color = Const.I; _schemes = new Scheme[2]; _schemes[0] = new Scheme(new[]{"#", "#", "#", "#"}); _schemes[1] = new Scheme(new[] { "####" }); }
public FigureS() { _color = Const.S; _schemes = new Scheme[2]; _schemes[0] = new Scheme(new[] { "#.", "##", ".#" }); _schemes[1] = new Scheme(new[] { ".##", "##." }); }
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()); }
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[] { "..#", "###" }); }
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)); }
private Scheme(Scheme original) { model = (bool[][]) original.model.Clone(); }
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()); }