public void WhenRangeIsRange_ThenRandomLocationsIsNumberOfLocations(int range, int numberOfLocations) { var random = new Mock <IRandom>(); var randomLocation = new RandomLocation(random.Object); randomLocation.GetInRange(range); random.Verify(t => t.GetNext(0, numberOfLocations), Times.AtLeastOnce); }
public void WhenRandomLocationIsIndex_ThenLocationIsAtXAndY(int index, int x, int y) { var random = new Mock <IRandom>(); random .Setup(t => t.GetNext(0, It.IsAny <int>())) .Returns(() => index); var randomLocation = new RandomLocation(random.Object); var location = randomLocation.GetInRange(3); Assert.Equal(new Location(x, y), location); }