public DotnetTestHostManagerTests() { this.mockTestHostLauncher = new Mock <ITestHostLauncher>(); this.mockProcessHelper = new Mock <IProcessHelper>(); this.mockFileHelper = new Mock <IFileHelper>(); this.mockMessageLogger = new Mock <IMessageLogger>(); this.mockEnvironment = new Mock <IEnvironment>(); this.defaultConnectionInfo = new TestRunnerConnectionInfo { Port = 123, ConnectionInfo = new TestHostConnectionInfo { Endpoint = "127.0.0.1:123", Role = ConnectionRole.Client }, RunnerProcessId = 0 }; string defaultSourcePath = Path.Combine($"{Path.DirectorySeparatorChar}tmp", "test.dll"); this.defaultTestHostPath = @"\tmp\testhost.dll"; this.dotnetHostManager = new TestableDotnetTestHostManager( this.mockProcessHelper.Object, this.mockFileHelper.Object, new DotnetHostHelper(this.mockFileHelper.Object, this.mockEnvironment.Object), this.mockEnvironment.Object); this.dotnetHostManager.Initialize(this.mockMessageLogger.Object, string.Empty); this.dotnetHostManager.HostExited += this.DotnetHostManagerHostExited; // Setup a dummy current process for tests this.mockProcessHelper.Setup(ph => ph.GetCurrentProcessFileName()).Returns(DefaultDotnetPath); this.mockProcessHelper.Setup(ph => ph.GetTestEngineDirectory()).Returns(DefaultDotnetPath); this.mockFileHelper.Setup(ph => ph.Exists(this.defaultTestHostPath)).Returns(true); this.defaultTestProcessStartInfo = this.dotnetHostManager.GetTestHostProcessStartInfo(new[] { defaultSourcePath }, null, this.defaultConnectionInfo); }
public DotnetTestHostManagerTests() { this.mockTestHostLauncher = new Mock <ITestHostLauncher>(); this.mockProcessHelper = new Mock <IProcessHelper>(); this.mockFileHelper = new Mock <IFileHelper>(); this.mockMessageLogger = new Mock <IMessageLogger>(); this.defaultConnectionInfo = default(TestRunnerConnectionInfo); string defaultSourcePath = Path.Combine($"{Path.DirectorySeparatorChar}tmp", "test.dll"); this.defaultTestHostPath = @"\tmp\testhost.dll"; this.dotnetHostManager = new TestableDotnetTestHostManager( this.mockProcessHelper.Object, this.mockFileHelper.Object, new DotnetHostHelper(this.mockFileHelper.Object), this.maxStdErrStringLength); this.dotnetHostManager.Initialize(this.mockMessageLogger.Object, string.Empty); this.dotnetHostManager.HostExited += this.DotnetHostManagerHostExited; // Setup a dummy current process for tests this.mockProcessHelper.Setup(ph => ph.GetCurrentProcessFileName()).Returns(DefaultDotnetPath); this.mockProcessHelper.Setup(ph => ph.GetTestEngineDirectory()).Returns(DefaultDotnetPath); this.mockFileHelper.Setup(ph => ph.Exists(this.defaultTestHostPath)).Returns(true); this.defaultTestProcessStartInfo = this.dotnetHostManager.GetTestHostProcessStartInfo(new[] { defaultSourcePath }, null, this.defaultConnectionInfo); }
public void SetupChannelForDotnetHostManagerWithIsVersionCheckRequiredTrueShouldCheckVersionWithTestHost() { var testHostManager = new TestableDotnetTestHostManager(true); var operationManager = new TestableProxyOperationManager(this.mockRequestSender.Object, testHostManager, this.connectionTimeout); operationManager.SetupChannel(Enumerable.Empty <string>()); this.mockRequestSender.Verify(rs => rs.CheckVersionWithTestHost(), Times.Once); }
public void SetupChannelForDotnetHostManagerWithIsVersionCheckRequiredTrueShouldCheckVersionWithTestHost() { this.SetUpMocksForDotNetTestHost(); var testHostManager = new TestableDotnetTestHostManager(true, this.mockProcessHelper.Object, this.mockFileHelper.Object, this.mockEnvironment.Object); var operationManager = new TestableProxyOperationManager(this.mockRequestSender.Object, testHostManager, this.connectionTimeout); operationManager.SetupChannel(Enumerable.Empty <string>(), CancellationToken.None); this.mockRequestSender.Verify(rs => rs.CheckVersionWithTestHost(), Times.Once); }
public void SetupChannelForDotnetHostManagerWithIsVersionCheckRequiredFalseShouldNotCheckVersionWithTestHost() { this.SetUpMocksForDotNetTestHost(); var testHostManager = new TestableDotnetTestHostManager(false, this.mockProcessHelper.Object, this.mockFileHelper.Object, this.mockEnvironment.Object); var operationManager = new TestableProxyOperationManager(this.mockRequestData.Object, this.mockRequestSender.Object, testHostManager); operationManager.SetupChannel(Enumerable.Empty <string>()); this.mockRequestSender.Verify(rs => rs.CheckVersionWithTestHost(), Times.Never); }