public void TeleportUnit_WhenUnitToTeleportIsNull_ShouldThrowException() { var owner = new Mock<IBusinessOwner>(); var location = new Mock<ILocation>(); var galacticMap = new Mock<IEnumerable<IPath>>(); var teleportStation = new MockedTeleportStation(owner.Object, galacticMap.Object, location.Object); Assert.That(()=> teleportStation.TeleportUnit(null, location.Object), Throws.ArgumentNullException.With.Message.Contains("unitToTeleport")); }
public void Constructor_WhenNewStationIsCreatedWithValidParams_ShouldSetUpAllFields() { var owner = new Mock<IBusinessOwner>(); var location = new Mock<ILocation>(); var galacticMap = new Mock<IEnumerable<IPath>>(); var teleportStation = new MockedTeleportStation(owner.Object, galacticMap.Object, location.Object); Assert.That(teleportStation.IsNotNull); }
public void TeleportUnit_WhenUnitsLocationsAreEqual_ShouldThrowException() { var owner = new Mock<IBusinessOwner>(); var location = new Mock<ILocation>(); var unitToTeleport = new Mock<IUnit>(); var galacticMap = new Mock<IEnumerable<IPath>>(); var teleportStation = new MockedTeleportStation(owner.Object, galacticMap.Object, location.Object); Assert.That(() => teleportStation.TeleportUnit(unitToTeleport.Object, location.Object), Throws.InstanceOf<InvalidTeleportationLocationException>().With.Message.Contains("units will overlap")); }
public void TeleportUnit_WhenUnitIsTryingToUseTeleportStationFromDistantLocation_ShouldThrowException() { var owner = new Mock<IBusinessOwner>(); var location = new Mock<ILocation>(); var unitToTeleport = new Mock<IUnit>(); var galacticMap = new Mock<IEnumerable<IPath>>(); var planet = new Mock<IPlanet>(); var planet2 = new Mock<IPlanet>(); location.Setup(x => x.Planet).Returns(planet.Object); unitToTeleport.Setup(x => x.CurrentLocation.Planet).Returns(planet2.Object); var teleportStation = new MockedTeleportStation(owner.Object, galacticMap.Object, location.Object); Assert.That(() => teleportStation.TeleportUnit(unitToTeleport.Object, location.Object), Throws.InstanceOf<TeleportOutOfRangeException>().With.Message.Contains("unitToTeleport.CurrentLocation")); }