public void GetDefault_NoArgument_ReturnsNotNull() { // Arrange // Act var config = WebDriverConfigs.GetDefault(); // Assert Assert.NotNull(config); }
public void GetDefault_EnumDefaultType_ThrowsArgumentException() { // Arrange WebDriverType type = default(WebDriverType); // Act TestDelegate action = () => WebDriverConfigs.GetDefault(type); // Assert Assert.Throws <ArgumentException>(action); }
public void GetDefault_InvalidType_ThrowsArgumentException() { // Arrange string type = "not_a_valid_type"; // Act TestDelegate action = () => WebDriverConfigs.GetDefault(type); // Assert Assert.Throws <ArgumentException>(action); }
public void GetDefault_NullType_ThrowsArgumentNullException() { // Arrange string type = null; // Act TestDelegate action = () => WebDriverConfigs.GetDefault(type); // Assert Assert.Throws <ArgumentNullException>(action); }
public void GetDefault_StringType_ReturnsNotNull() { // Arrange string type = "Chrome"; // Act var config = WebDriverConfigs.GetDefault(type); // Assert Assert.NotNull("Chrome"); }
public void GetFromPreset_NullPreset_ThrowsArgumentNullException() { // Arrange string preset = null; // Act TestDelegate action = () => WebDriverConfigs.GetFromPreset(WebDriverType.Chrome, preset); // Assert Assert.Throws <ArgumentNullException>(action); }
public void GetFromPreset_FilledWrongPresetName_ThrowsException() { // Arrange WebDriverType type = WebDriverType.Chrome; string preset = "wrongPreset"; // Act TestDelegate action = () => WebDriverConfigs.GetFromPreset(type, preset); // Assert Assert.Throws <MissingWebDriverConfigSectionException>(action); }
public void GetFromPreset_FilledPreset_NotNull() { // Arrange WebDriverType type = WebDriverType.Chrome; string preset = "chrome"; // Act var actual = WebDriverConfigs.GetFromPreset(type, preset) as ChromeWebDriverConfig; //Assert Assert.NotNull(actual); }
public void GetFromPreset_EnumDefaultType_ThrowsArgumentNullException() { // Arrange WebDriverType type = default(WebDriverType); string preset = null; // Act TestDelegate action = () => WebDriverConfigs.GetFromPreset(type, preset); // Assert Assert.Throws <ArgumentException>(action); }
public void GetDefault_EmptyType_ThrowsArgumentException() { // Arrange // Act TestDelegate[] actions = { () => WebDriverConfigs.GetDefault(""), () => WebDriverConfigs.GetDefault(" ") }; // Assert AssertMultiple.Throws <ArgumentException>(actions); }
public void GetFromPreset_EmptyPreset_ThrowsArgumentException() { // Arrange // Act TestDelegate[] actions = { () => WebDriverConfigs.GetFromPreset(WebDriverType.Chrome, ""), () => WebDriverConfigs.GetFromPreset(WebDriverType.Chrome, " ") }; // Assert AssertMultiple.Throws <ArgumentException>(actions); }
protected WbTstrFixtureBase() { if (Attribute.GetCustomAttribute(GetType(), typeof(WebDriverConfigAttribute)) is WebDriverConfigAttribute attribute) { _webDriverScope = attribute.Scope; bool usePreset = !string.IsNullOrEmpty(attribute.Preset); _webDriverConfig = usePreset ? WebDriverConfigs.GetFromPreset(attribute.Type, attribute.Preset) : WebDriverConfigs.GetDefault(attribute.Type); } else { throw new MissingWebDriverConfigException("WebDriverConfig attribute is not present."); } }
public void GetDefault_NonDefaultEnumTypes_DoesNotThrow() { // Arrange var webDriverTypes = Enum.GetValues(typeof(WebDriverType)).Cast <WebDriverType>(); // Act var actions = new List <TestDelegate>(); foreach (var webDriverType in webDriverTypes) { if (webDriverType == default(WebDriverType)) { continue; } actions.Add(() => WebDriverConfigs.GetDefault(webDriverType)); } // Assert AssertMultiple.DoesNotThrow(actions); }
public void GetDefault_NonDefaultEnumTypes_ReturnRightConfigType() { // Arrange var webDriverTypes = Enum.GetValues(typeof(WebDriverType)).Cast <WebDriverType>(); // Act var webDriverConfigs = new Dictionary <WebDriverType, IWebDriverConfig>(); foreach (var webDriverType in webDriverTypes) { if (webDriverType == default(WebDriverType)) { continue; } webDriverConfigs[webDriverType] = WebDriverConfigs.GetDefault(webDriverType); } // Assert foreach (var webDriverConfig in webDriverConfigs) { Assert.AreEqual(webDriverConfig.Value.Type, webDriverConfig.Key); } }