示例#1
0
        public void LaunchTestHostShouldReturnTestHostProcessId()
        {
            var mockProcessHelper = new TestableProcessHelper();

            var testHostManager = new DefaultTestHostManager(Architecture.X64, Framework.DefaultFramework, mockProcessHelper, true);
            var startInfo       = testHostManager.GetTestHostProcessStartInfo(Enumerable.Empty <string>(), null, default(TestRunnerConnectionInfo));

            Task <int> processId = testHostManager.LaunchTestHostAsync(startInfo);

            try
            {
                processId.Wait();
            }
            catch (AggregateException) { }

            Assert.AreEqual(Process.GetCurrentProcess().Id, processId.Result);
        }
        public void LaunchTestHostShouldReturnTestHostProcessId()
        {
            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> >())).Returns(Process.GetCurrentProcess());

            var testHostManager = new DefaultTestHostManager(Architecture.X64, Framework.DefaultFramework, this.mockProcessHelper.Object, true);
            var startInfo       = testHostManager.GetTestHostProcessStartInfo(Enumerable.Empty <string>(), null, default(TestRunnerConnectionInfo));

            Task <int> processId = testHostManager.LaunchTestHostAsync(startInfo);

            processId.Wait();

            Assert.AreEqual(Process.GetCurrentProcess().Id, processId.Result);
        }