Skip to content

Commit

Permalink
Improved coverage of Matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
ben_pollard committed Dec 8, 2024
1 parent efb7c9f commit a704247
Showing 1 changed file with 46 additions and 1 deletion.
47 changes: 46 additions & 1 deletion NetAF.Tests/Assets/Locations/Matrix_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,51 @@ public void Given1RoomOnZ1_WhenFindAllRoomsOnZ_Then1Room()

[TestMethod]
public void Given2Point1UnitApart_WhenDistanceBetweenPoints_Then1()
{
List<RoomPosition> roomPositions =
[
new(new(string.Empty, string.Empty), new Point3D(0, 0, 0)),
new(new(string.Empty, string.Empty), new Point3D(0, 1, 0))
];
var matrix = new Matrix([.. roomPositions]);

var result = matrix.DistanceBetweenRooms(roomPositions[0].Room, roomPositions[1].Room);

Assert.AreEqual(1, (int)result);
}

[TestMethod]
public void GivenANull_WhenDistanceBetweenPoints_Then0()
{
List<RoomPosition> roomPositions =
[
new(new(string.Empty, string.Empty), new Point3D(0, 0, 0)),
new(new(string.Empty, string.Empty), new Point3D(0, 1, 0))
];
var matrix = new Matrix([.. roomPositions]);

var result = matrix.DistanceBetweenRooms(null, roomPositions[1].Room);

Assert.AreEqual(0, (int)result);
}

[TestMethod]
public void GivenBNull_WhenDistanceBetweenPoints_Then0()
{
List<RoomPosition> roomPositions =
[
new(new(string.Empty, string.Empty), new Point3D(0, 0, 0)),
new(new(string.Empty, string.Empty), new Point3D(0, 1, 0))
];
var matrix = new Matrix([.. roomPositions]);

var result = matrix.DistanceBetweenRooms(roomPositions[0].Room, null);

Assert.AreEqual(0, (int)result);
}

[TestMethod]
public void Given2Point1UnitApart_WhenDistanceBetweenRooms_Then1()
{
Point3D a = new(0, 0, 0);
Point3D b = new(1, 0, 0);
Expand All @@ -154,7 +199,7 @@ public void Given2Point1UnitApart_WhenDistanceBetweenPoints_Then1()
}

[TestMethod]
public void GivenVisitedRoomOn1And1VisitedRoomOn3_When_ThenReturnContaining1And3()
public void GivenVisitedRoomOn1And1VisitedRoomOn3_WhenFindAllZWithVisitedRooms_ThenReturnContaining1And3()
{
List<RoomPosition> roomPositions =
[
Expand Down

0 comments on commit a704247

Please sign in to comment.