public void DesignModeClientLaunchCustomHostMustThrowIfCancellationOccursBeforeHostLaunch() { var testableDesignModeClient = new TestableDesignModeClient(this.mockCommunicationManager.Object, JsonDataSerializer.Instance, this.mockPlatformEnvrironment.Object); var info = new TestProcessStartInfo(); var cancellationTokenSource = new CancellationTokenSource(); cancellationTokenSource.Cancel(); testableDesignModeClient.LaunchCustomHost(info, cancellationTokenSource.Token); }
public void DesignModeClientLaunchCustomHostMustThrowIfInvalidAckComes() { var testableDesignModeClient = new TestableDesignModeClient(this.mockCommunicationManager.Object, JsonDataSerializer.Instance); this.mockCommunicationManager.Setup(cm => cm.WaitForServerConnection(It.IsAny <int>())).Returns(true); var expectedProcessId = -1; Action sendMessageAction = () => { testableDesignModeClient.InvokeCustomHostLaunchAckCallback(expectedProcessId, "Dummy"); }; this.mockCommunicationManager.Setup(cm => cm.SendMessage(MessageType.CustomTestHostLaunch, It.IsAny <object>())). Callback(() => Task.Run(sendMessageAction)); var info = new TestProcessStartInfo(); var processId = testableDesignModeClient.LaunchCustomHost(info); }
public void DesignModeClientLaunchCustomHostMustReturnIfAckComes() { var testableDesignModeClient = new TestableDesignModeClient(this.mockCommunicationManager.Object, JsonDataSerializer.Instance, this.mockPlatformEnvrironment.Object); this.mockCommunicationManager.Setup(cm => cm.WaitForServerConnection(It.IsAny <int>())).Returns(true); var expectedProcessId = 1234; Action sendMessageAction = () => { testableDesignModeClient.InvokeCustomHostLaunchAckCallback(expectedProcessId, null); }; this.mockCommunicationManager.Setup(cm => cm.SendMessage(MessageType.CustomTestHostLaunch, It.IsAny <object>())). Callback(() => Task.Run(sendMessageAction)); var info = new TestProcessStartInfo(); var processId = testableDesignModeClient.LaunchCustomHost(info, CancellationToken.None); Assert.AreEqual(expectedProcessId, processId); }