public void LaunchRequestIsSentOnLaunchSuspended() { var launches = new List <LaunchGameRequest>(); var gameletClientFactory = new GameletClientStub.Factory().WithSampleInstance() .WithLaunchRequestsTracker(launches); IVSFake vsFake = CreateVsFakeAndLoadProject(gameletClientFactory); _taskContext.RunOnMainThread(() => vsFake.LaunchSuspended()); Assert.That(launches.Count, Is.EqualTo(1)); Assert.That(launches[0].GameletName, Is.EqualTo(_instanceLocation)); Assert.That(launches[0].ApplicationName, Is.EqualTo(_applicationName)); Assert.That(launches[0].ExecutablePath, Does.Contain(_sampleName)); }
public void RunOnMainThread() { Assert.Throws <TestException>(() => taskContext.RunOnMainThread(() => { Assert.That(taskContext.IsOnMainThread, Is.True); throw new TestException(); })); }
void Launch(bool resume) { IDebugEngine2 debugEngine = null; _taskContext.RunOnMainThread(() => debugEngine = _createDebugEngine()); _debugSessionContext.DebugEngine = debugEngine; _debugSessionContext.ProgramState = ProgramState.NotStarted; IDebugEngineLaunch2 debugEngineLauncher = (IDebugEngineLaunch2)debugEngine; // TODO: Use the correct DebugLaunchOptions value. var launchSettings = _targetAdapter.QueryDebugTargets(_projectAdapter.Project, 0).First(); var port = _targetAdapter.InitializePort(_debugEventCallback, debugEngine); HResultChecker.Check(debugEngineLauncher.LaunchSuspended("", // server port, launchSettings.Executable, launchSettings.Arguments, "", // dir, "", // env launchSettings.Options, default(enum_LAUNCH_FLAGS), 0, // stdinput, 0, // stdoutput, 0, // stderr, _debugEventCallback, out IDebugProcess2 process)); _debugSessionContext.Process = process; _debugSessionContext.ProgramState = ProgramState.LaunchSuspended; if (resume) { HResultChecker.Check(debugEngineLauncher.ResumeProcess(process)); } }
void Bind(Breakpoint breakpoint) { using (var breakpointRequest = breakpoint.CreateRequest()) { IDebugPendingBreakpoint2 pendingBreakpoint = null; _taskContext.RunOnMainThread(() => HResultChecker.Check( _debugSessionContext.DebugEngine.CreatePendingBreakpoint( breakpointRequest, out pendingBreakpoint))); breakpoint.PendingBreakpoint = pendingBreakpoint; _pendingToBreakpoint[pendingBreakpoint] = breakpoint; HResultChecker.Check(pendingBreakpoint.Enable(1)); if (pendingBreakpoint.Virtualize(1) != VSConstants.E_NOTIMPL) { throw new InvalidOperationException("VSFake should be updated to handle " + $"{nameof(pendingBreakpoint.Virtualize)}."); } pendingBreakpoint.Bind(); } }