Skip to content

Commit

Permalink
Add test return home not scheduled if area is null
Browse files Browse the repository at this point in the history
  • Loading branch information
mrica-equinor committed Apr 22, 2024
1 parent 2ddb7bc commit 9d167d1
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions backend/api.test/EventHandlers/TestMissionEventHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -359,5 +359,27 @@ public async void LocalizationMissionCompletesAfterPressingSendToSafeZoneButton(
bool isRobotLocalized = await _localizationService.RobotIsLocalized(robot.Id);
Assert.True(isRobotLocalized);
}

[Fact]
public async void ReturnHomeMissionNotScheduledIfRobotIsNotLocalized()
{
// Arrange
var installation = await _databaseUtilities.NewInstallation();
var robot = await _databaseUtilities.NewRobot(RobotStatus.Busy, installation, null);

Thread.Sleep(100);

// Act
var eventArgs = new RobotAvailableEventArgs(robot.Id);
_missionEventHandler.RaiseEvent(nameof(MissionSchedulingService.RobotAvailable), eventArgs);

Thread.Sleep(100);

// Assert
bool isRobotLocalized = await _localizationService.RobotIsLocalized(robot.Id);
Assert.False(isRobotLocalized);
Assert.False(await _missionRunService.PendingOrOngoingReturnToHomeMissionRunExists(robot.Id));

}
}
}

0 comments on commit 9d167d1

Please sign in to comment.