public async Task TestGameletRunningStopReturnsTrueAsync() { _gamelet1.State = GameletState.InUse; var stoppedGamelet = _gamelet1.Clone(); stoppedGamelet.State = GameletState.Reserved; _gameletClient.GetGameletByNameAsync(_gamelet1.Name) .Returns(Task.FromResult(stoppedGamelet)); _dialogUtil.ShowYesNo(Arg.Any <string>(), Arg.Any <string>()).Returns(true); Gamelet gamelet; var result = _gameletSelector.TrySelectAndPrepareGamelet(_targetPath, _deploy, new List <Gamelet> { _gamelet1 }, null, _devAccount, out gamelet); Assert.That(result, Is.True); Assert.That(gamelet.Id, Is.EqualTo(_gamelet1.Id)); Assert.That(gamelet.State, Is.EqualTo(GameletState.Reserved)); await _gameletClient.Received(1).StopGameAsync(_gamelet1.Id); AssertMetricRecorded(DeveloperEventType.Types.Type.VsiGameletsSelect, DeveloperEventStatus.Types.Code.Success); AssertMetricRecorded(DeveloperEventType.Types.Type.VsiGameletsClearLogs, DeveloperEventStatus.Types.Code.Success); }
public async Task EnableSshOptimisticCheckFailSshCommandAsync() { sshKeyLoader.LoadOrCreateAsync().Returns(fakeKey); remoteCommand.RunWithSuccessAsync(null, null).ReturnsForAnyArgs( Task.FromException(new YetiCommon.ProcessException("SSH exception"))); await sshManager.EnableSshAsync(fakeGamelet, fakeAction); await gameletClient.Received(1).EnableSshAsync(fakeGamelet.Id, fakeKey.PublicKey); }