So, I was not totally sure this was true:
[TestClass]
public class UnitTest1
{
private int i = 0;
[TestMethod]
public void TestMethod1()
{
Thread.Sleep(5000);
Assert.IsTrue(i == 10);
}
[TestMethod]
public void TestMethod2() {
i = 10;
}
}
By the results of the test, it looks like it isn't, but I'd like to know for sure that if I define a global variable on a Test Method, it can't be read by other Test Methods.
Also, do I have to define
[TestCleanup]
public void Test_Cleanup() {
engine = null;
}
becase of this
[TestInitialize]
public void Test_Initialize()
{
var pieceGeneratorMock = new Mock<IPieceGenerator>();
pieceGeneratorMock.Setup(pg => pg.Generate())
.Returns(new Piece(Color.Red));
IPieceGenerator pieceGenerator = pieceGeneratorMock.Object;
Size size = new Size(4, 4);
BackgroundBoard backgroundBoard = new BackgroundBoard(size);
PieceBoard pieceBoard = new PieceBoard(size);
engine = new Engine(pieceGenerator, backgroundBoard, pieceBoard);
}
?