Archived
1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
Tetris/TestTetris/GameTest.cs

41 lines
1.1 KiB
C#
Raw Normal View History

using System;
using System.Drawing;
using NUnit.Framework;
using Tetris.Models;
namespace TestTetris;
public class GameTest {
private Game g;
[SetUp]
public void SetUp() {
g = new("test", new Grid(new Color[10,20]));
Console.Out.WriteLine("===={Grid w/ Tetrominoe}====");
Console.Out.WriteLine(g.Grid.ToString(g.CurrentTetrominoe));
Console.Out.WriteLine("============================");
}
[Test]
public void HitBottom() {
for (int i = 1; i < (g.Grid.MaxGrid.Y+1)-g.CurrentTetrominoe.Shape.GetLength(1)+1; i++) {
g.CurrentTetrominoe.GoDown();
Console.Out.WriteLine(g.Grid.ToString(g.CurrentTetrominoe));
}
Assert.AreEqual(true, g.HitBottom());
}
[Test]
public void HitTop() {
Assert.False(g.HitTop());
for (int x = 0; x <= g.Grid.MaxGrid.X; x++)
g.Grid.CGrid[x,g.CurrentTetrominoe.Shape.GetLength(1)] = Color.Red;
Console.Out.WriteLine(g.Grid.ToString(g.CurrentTetrominoe));
Assert.True(g.HitTop());
}
}