public void CreateAndConfigure_ShouldNotConfigureBrowserWhenNoBrowserConfigurationSpecified() { // Arrange var testSpecification = new TestSpecification("Fancy scenario", "178wq76essf"); var browserHost = Substitute.For <IBrowserHost>(); var capabilities = Substitute.For <ICapabilities>(); _capabilitiesBuilder.Build().Returns(capabilities); _browserHostFactory.CreateWithCapabilities(capabilities).Returns(browserHost); // Act var result = _sut.CreateAndConfigure(testSpecification); // Assert result.Should().BeSameAs(browserHost); _capabilitiesBuilder.DidNotReceive().WithBrowserConfiguration(Arg.Any <BrowserConfiguration>()); _capabilitiesBuilder.Received().WithRunTestLocally(false); }
public IBrowserHost CreateAndConfigure(TestSpecification testSpecification, string browser = null) { var builder = _capabilitiesBuilder.WithTestSpecification(testSpecification); BrowserConfiguration browserConfiguration = null; if (browser != null) { browserConfiguration = _parser.Parse(browser); builder.WithBrowserConfiguration(browserConfiguration); } var capabilities = builder.WithRunTestLocally(_configurationProvider.RunTestLocally).Build(); return(_configurationProvider.LocalBrowser.HasValue ? _browserHostFactory.CreateLocalWebDriver(_configurationProvider.LocalBrowser.Value, browserConfiguration) : _browserHostFactory.CreateWithCapabilities(capabilities, browserConfiguration)); }