-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests for examples in docs and updated docs (#5)
- Loading branch information
Showing
3 changed files
with
79 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
using System.Collections.Generic; | ||
using HexCore; | ||
using NUnit.Framework; | ||
|
||
namespace HexCoreTests | ||
{ | ||
[TestFixture] | ||
public class Documentation | ||
{ | ||
[Test] | ||
public void TerrainMovementTypeExample_ShouldWork() | ||
{ | ||
var ground = new TerrainType(1, "Ground"); | ||
var water = new TerrainType(2, "Water"); | ||
|
||
var walkingType = new MovementType(1, "Walking"); | ||
var swimmingType = new MovementType(2, "Swimming"); | ||
|
||
var movementTypes = new MovementTypes( | ||
new TerrainType[] { ground, water }, | ||
new Dictionary<MovementType, Dictionary<TerrainType, int>> | ||
{ | ||
[walkingType] = new Dictionary<TerrainType, int> | ||
{ | ||
[ground] = 1, | ||
[water] = 2 | ||
}, | ||
[swimmingType] = new Dictionary<TerrainType, int> | ||
{ | ||
[ground] = 2, | ||
[water] = 1 | ||
} | ||
} | ||
); | ||
} | ||
|
||
[Test] | ||
public void CellStateExample_ShouldWork() | ||
{ | ||
var ground = new TerrainType(1, "Ground"); | ||
var water = new TerrainType(2, "Water"); | ||
|
||
var walkingType = new MovementType(1, "Walking"); | ||
var swimmingType = new MovementType(2, "Swimming"); | ||
|
||
var movementTypes = new MovementTypes( | ||
new TerrainType[] { ground, water }, | ||
new Dictionary<MovementType, Dictionary<TerrainType, int>> | ||
{ | ||
[walkingType] = new Dictionary<TerrainType, int> | ||
{ | ||
[ground] = 1, | ||
[water] = 2 | ||
}, | ||
[swimmingType] = new Dictionary<TerrainType, int> | ||
{ | ||
[ground] = 2, | ||
[water] = 1 | ||
} | ||
} | ||
); | ||
|
||
var graph = new Graph(new CellState[] { | ||
new CellState(false, new Coordinate2D(0,0, OffsetTypes.OddRowsRight), ground), | ||
new CellState(false, new Coordinate2D(0,1, OffsetTypes.OddRowsRight), ground), | ||
new CellState(true, new Coordinate2D(1,0, OffsetTypes.OddRowsRight), water), | ||
new CellState(false, new Coordinate2D(1,1, OffsetTypes.OddRowsRight), water), | ||
new CellState(false, new Coordinate2D(1,2, OffsetTypes.OddRowsRight), ground) | ||
}, movementTypes); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters