public void ReleaseElevator_WhenIncorrectIdProvided_ThrowsException() { // Arrange buildingConfigurationServiceMock .Setup(x => x.GetNumberOfElevators()) .Returns(1); sut = new ElevatorPoolService( elevatorEventLogServiceMock.Object, buildingConfigurationServiceMock.Object, routeValidationServiceMock.Object); // Act sut.ReleaseElevator(2); }
public void ReleaseElevator_WhenElevatorIsNotOccupied_DoesNotReleaseElevator() { // Arrange buildingConfigurationServiceMock .Setup(x => x.GetNumberOfElevators()) .Returns(1); sut = new ElevatorPoolService( elevatorEventLogServiceMock.Object, buildingConfigurationServiceMock.Object, routeValidationServiceMock.Object); // Act sut.ReleaseElevator(0); // Assert elevatorEventLogServiceMock.Verify(x => x.LogEvent(It.IsAny <ElevatorModel>(), It.IsAny <string>()), Times.Never); }
public void ReleaseElevator_WhenElevatorIsOccupied_ReleasesElevator() { // Arrange routeValidationServiceMock .Setup(x => x.IsFloorNumberCorrect(It.IsAny <int>())) .Returns(true); buildingConfigurationServiceMock .Setup(x => x.GetNumberOfElevators()) .Returns(1); sut = new ElevatorPoolService( elevatorEventLogServiceMock.Object, buildingConfigurationServiceMock.Object, routeValidationServiceMock.Object); // Act sut.TakeClosestElevator(1); sut.ReleaseElevator(0); // Assert elevatorEventLogServiceMock.Verify(x => x.LogEvent(It.IsAny <ElevatorModel>(), It.IsAny <string>()), Times.Exactly(2)); }