コード例 #1
0
        public void ExecutorExecuteSetsParentProcessIdOnDesignModeInitializer()
        {
            var parentProcessId = 2346;
            var parentProcessIdArgumentExecutor = new ParentProcessIdArgumentExecutor(CommandLineOptions.Instance);

            parentProcessIdArgumentExecutor.Initialize(parentProcessId.ToString());

            int actualParentProcessId = -1;

            this.executor = new PortArgumentExecutor(CommandLineOptions.Instance,
                                                     this.testRequestManager.Object,
                                                     (ppid, ph) =>
            {
                actualParentProcessId = ppid;
                return(testDesignModeClient.Object);
            },
                                                     this.mockProcessHelper.Object
                                                     );

            int port = 2345;

            this.executor.Initialize(port.ToString());
            var result = executor.Execute();

            testDesignModeClient.Verify(td =>
                                        td.ConnectToClientAndProcessRequests(port, testRequestManager.Object), Times.Once);

            Assert.AreEqual(parentProcessId, actualParentProcessId, "Parent process Id must be set correctly on design mode initializer");

            Assert.AreEqual(ArgumentProcessorResult.Success, result);
        }
コード例 #2
0
        public void ExecutorExecuteForFailedConnectionShouldThrowCommandLineException()
        {
            this.executor = new PortArgumentExecutor(CommandLineOptions.Instance, this.testRequestManager.Object,
                                                     (parentProcessId, ph) => testDesignModeClient.Object, this.mockProcessHelper.Object);

            testDesignModeClient.Setup(td => td.ConnectToClientAndProcessRequests(It.IsAny <int>(),
                                                                                  It.IsAny <ITestRequestManager>())).Callback(() => { throw new TimeoutException(); });

            int port = 2345;

            this.executor.Initialize(port.ToString());
            Assert.ThrowsException <CommandLineException>(() => executor.Execute());

            testDesignModeClient.Verify(td => td.ConnectToClientAndProcessRequests(port, this.testRequestManager.Object), Times.Once);
        }
コード例 #3
0
        public void ExecutorExecuteForValidConnectionReturnsArgumentProcessorResultSuccess()
        {
            this.executor = new PortArgumentExecutor(CommandLineOptions.Instance, this.testRequestManager.Object,
                                                     (parentProcessId, ph) => this.testDesignModeClient.Object, this.mockProcessHelper.Object);

            int port = 2345;

            this.executor.Initialize(port.ToString());
            var result = executor.Execute();

            this.testDesignModeClient.Verify(td =>
                                             td.ConnectToClientAndProcessRequests(port, this.testRequestManager.Object), Times.Once);

            Assert.AreEqual(ArgumentProcessorResult.Success, result);
        }