Unit tests for Block
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
Blocks.Tests BlockTests
Namespace: Blocks.Tests
Assembly: Blocks.Tests (in Blocks.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The BlockTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
BlockTests | Initializes a new instance of the BlockTests class |
Methods
Name | Description | |
---|---|---|
AdvanceTimeAndUpdateEntities | (Inherited from TestWithMocksOrVisually.) | |
CheckIBlockAppearsATenthOfTheTime | ||
ConstructorTopLeft | ||
InitializeResolver | (Inherited from TestWithMocksOrVisually.) | |
Left | ||
RegisterMock T | (Inherited from TestWithMocksOrVisually.) | |
RenderJBlock | ||
Resolve T | (Inherited from TestWithMocksOrVisually.) | |
RotateAntiClockwise | ||
RotateClockwise | ||
RunAfterFirstFrame | (Inherited from TestWithMocksOrVisually.) | |
RunTestAndDisposeResolverWhenDone | (Inherited from TestWithMocksOrVisually.) | |
SetUp | ||
Top |
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
[Test, CloseAfterFirstFrame] public void ConstructorTopLeft() { var block = new Block(displayMode, content, new Vector2D(1, 2)); Assert.AreEqual(1, block.Left); Assert.AreEqual(2, block.Top); }
[Test, CloseAfterFirstFrame] public void RotateClockwise() { var block = new Block(displayMode, content, new Vector2D(8, 1)); block.RotateClockwise(); }
[Test, CloseAfterFirstFrame] public void RotateAntiClockwise() { var block = new Block(displayMode, content, new Vector2D(8, 1)); block.RotateAntiClockwise(); }
[Test, CloseAfterFirstFrame] public void Left() { var shape = new Block(displayMode, content, Vector2D.Zero) { Left = 1 }; Assert.AreEqual(1, shape.Left); Assert.AreEqual(1, shape.Bricks[0].TopLeftGridCoord.X); Assert.AreEqual(1, shape.Bricks[1].TopLeftGridCoord.X); Assert.AreEqual(1, shape.Bricks[2].TopLeftGridCoord.X); Assert.AreEqual(1, shape.Bricks[3].TopLeftGridCoord.X); }
[Test, CloseAfterFirstFrame] public void Top() { var shape = new Block(displayMode, content, Vector2D.Zero) { Top = 1 }; Assert.AreEqual(1, shape.Top); Assert.AreEqual(1, shape.Bricks[0].TopLeftGridCoord.Y); Assert.AreEqual(1, shape.Bricks[1].TopLeftGridCoord.Y); Assert.AreEqual(1, shape.Bricks[2].TopLeftGridCoord.Y); Assert.AreEqual(1, shape.Bricks[3].TopLeftGridCoord.Y); }
[Test, CloseAfterFirstFrame] public void CheckIBlockAppearsATenthOfTheTime() { int count = 0; for (int i = 0; i < 1000; i++) { var block = new Block(displayMode, content, Vector2D.Zero); if (block.ToString() == "OOOO/..../..../...." || block.ToString() == "O.../O.../O.../O...") count++; } Assert.AreEqual(100, count, 50); }
[Test, CloseAfterFirstFrame] public void RenderJBlock() { { var block = new Block(displayMode, content, Vector2D.Zero); block.UpdateBrickDrawAreas(0.0f); } }
See Also