Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }