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);
        }
        void SetupGetGameletApi(Gamelet gamelet, params GameletState[] states)
        {
            IEnumerable <Task <Gamelet> > gameletCopies = states.Select(state =>
            {
                Gamelet gameletCopy = gamelet.Clone();
                gameletCopy.State   = state;
                return(Task.FromResult(gameletCopy));
            }).ToList();

            _gameletClient.GetGameletByNameAsync(gamelet.Name)
            .Returns(gameletCopies.First(), gameletCopies.Skip(1).ToArray());
        }