コード例 #1
0
        private void ExitCallBackTestHelper(int exitCode)
        {
            this.testableTestHostManager = new TestableTestHostManager(
                Architecture.X64,
                Framework.DefaultFramework,
                this.mockProcessHelper.Object,
                true,
                this.maxStdErrStringLength,
                this.mockMessageLogger.Object);

            this.testableTestHostManager.HostExited += this.TestableTestHostManagerHostExited;

            this.mockProcessHelper.Setup(
                ph =>
                ph.LaunchProcess(
                    It.IsAny <string>(),
                    It.IsAny <string>(),
                    It.IsAny <string>(),
                    It.IsAny <IDictionary <string, string> >(),
                    It.IsAny <Action <object, string> >(),
                    It.IsAny <Action <object> >()))
            .Callback <string, string, string, IDictionary <string, string>, Action <object, string>, Action <object> >(
                (var1, var2, var3, dictionary, errorCallback, exitCallback) =>
            {
                var process = Process.GetCurrentProcess();
                exitCallback(process);
            }).Returns(Process.GetCurrentProcess());

            this.mockProcessHelper.Setup(ph => ph.TryGetExitCode(It.IsAny <object>(), out exitCode)).Returns(true);
        }
コード例 #2
0
ファイル: ProcessHelperTests.cs プロジェクト: ivanz/vstest
        public ProcessHelperTests()
        {
            this.mockRequestSender = new Mock <ITestRequestSender>();
            this.mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(this.connectionTimeout)).Returns(true);

            this.processHelper   = new TestableProcessHelper();
            this.testHostManager = new TestableTestHostManager(Architecture.X64, Framework.DefaultFramework, this.processHelper, true, errorLength);

            this.testOperationManager = new TestableProxyOperationManager(this.mockRequestSender.Object, this.testHostManager, this.connectionTimeout, this.errorLength);
            this.sessionMessageLogger = TestSessionMessageLogger.Instance;
            this.sessionMessageLogger.TestRunMessage += this.TestSessionMessageHandler;
        }
コード例 #3
0
        public void LaunchTestHostAsyncShouldNotStartHostProcessIfCancellationTokenIsSet()
        {
            this.testableTestHostManager = new TestableTestHostManager(
                Architecture.X64,
                Framework.DefaultFramework,
                this.mockProcessHelper.Object,
                true,
                this.mockMessageLogger.Object);

            CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();

            cancellationTokenSource.Cancel();

            Assert.ThrowsException <System.AggregateException>(() => this.testableTestHostManager.LaunchTestHostAsync(this.GetDefaultStartInfo(), cancellationTokenSource.Token).Wait());
        }