Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task 344: fix Codacy patterm Switch shoud contain default case and should have … #346

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions JDI.Light/JDI.Light/Factories/UIElementFactory.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System;
using System.Collections.Generic;
using System.Net;
using System.Reflection;
using JDI.Light.Attributes;
using JDI.Light.Elements.Base;
Expand Down Expand Up @@ -40,11 +41,12 @@ public static IBaseUIElement CreateInstance(Type t, By locator, IBaseElement par
instance.Parent = parent;
return instance;
}

}
}
throw new MissingMethodException($"Can't find correct constructor to create instance of type {t}");
}

public static T CreateInstance<T>(By locator, IBaseElement parent) where T : IBaseUIElement
{
return (T)CreateInstance(typeof(T), locator, parent);
Expand Down Expand Up @@ -116,4 +118,4 @@ public static IBaseElement GetInstanceElement(this IBaseElement parent, MemberIn
return element;
}
}
}
}
12 changes: 10 additions & 2 deletions JDI.Light/JDI.Light/Factories/WebDriverFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,13 @@ public void SetRunType(string runType)
case "remote":
RunType = RunType.Remote;
return;
default:
{
RunType = RunType.Local;
break;
}
}

RunType = RunType.Local;
}

public bool HasDrivers()
Expand Down Expand Up @@ -248,9 +252,13 @@ public string RegisterDriver(DriverType driverType)
return RegisterLocalDriver(driverType);
case RunType.Remote:
return RegisterRemoteDriver(driverType);
default:
{
throw new Exception($"Can't register driver: {driverType}");
break;
}
}

throw new Exception($"Can't register driver: {driverType}");
}

private string RegisterRemoteDriver(DriverType driverType)
Expand Down