示例#1
0
 public void TestMixed()
 {
     var game = new Game();
     game.SetNumber(3, 1, 2);
     game.SetNumber(3, 2, 2);
     game.SetNumber(3, 3, 4);
     var res = game.Update(Direction.Up);
     Assert.AreEqual<uint>(2, game.GetNumber(0, 1));
     Assert.AreEqual<uint>(2, game.GetNumber(0, 2));
     Assert.AreEqual<uint>(4, game.GetNumber(0, 3));
     Assert.AreEqual(new Coordinate(0, 1), game.Transformations[3, 1].Destination);
     Assert.AreEqual(new Coordinate(0, 2), game.Transformations[3, 2].Destination);
     Assert.AreEqual(new Coordinate(0, 3), game.Transformations[3, 3].Destination);
     Assert.AreEqual(-1, game.Smoothness());
     Assert.AreEqual(1, game.Coherence());
     Assert.AreEqual<uint>(0, res.MergedCount);
     res = game.Update(Direction.Right);
     Assert.AreEqual<uint>(0, game.GetNumber(0, 1));
     Assert.AreEqual<uint>(4, game.GetNumber(0, 2));
     Assert.AreEqual<uint>(4, game.GetNumber(0, 3));
     Assert.AreEqual<uint>(1, res.MergedCount);
     Assert.AreEqual(new Coordinate(0, 2), game.Transformations[0, 1].Destination);
     Assert.AreEqual(true, game.Transformations[0, 2].WasNew);
     Assert.AreEqual(1, game.Coherence());
     res = game.Update(Direction.Left);
     Assert.AreEqual<uint>(8, game.GetNumber(0, 0));
     Assert.AreEqual<uint>(0, game.GetNumber(0, 2));
     Assert.AreEqual<uint>(0, game.GetNumber(0, 3));
     Assert.AreEqual(new Coordinate(0, 0), game.Transformations[0, 2].Destination);
     Assert.AreEqual(true, game.Transformations[0, 0].WasNew);
     Assert.AreEqual<uint>(1, res.MergedCount);
 }