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

fix: ToLower/ToUpper to ToLowerInvariant/ToUpperInvariant #921

Merged
merged 8 commits into from
Mar 13, 2025
Merged
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
2 changes: 1 addition & 1 deletion src/Appium.Net/Appium/ScreenOrientationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static class ScreenOrientationExtensions
/// <param name="orientation"></param>
/// <returns></returns>
public static string JSONWireProtocolString(this ScreenOrientation orientation) =>
orientation.ToString().ToUpper();
orientation.ToString().ToUpperInvariant();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related tests passed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the enum to string conversion on my local with ToUpperInvariant, while my env didn't cause the #920, so it tested the output didn't change with ToUpper though


/// <summary>
/// Converts the string to a screen orientation if possible, else throws ArgumentOutOfRangeException
Expand Down
4 changes: 2 additions & 2 deletions src/Appium.Net/Appium/Service/Options/OptionCollector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private string ParseCapabilitiesIfWindows()
{
if (typeof(bool).IsAssignableFrom(value.GetType()))
{
value = Convert.ToString(value).ToLower();
value = Convert.ToString(value).ToLowerInvariant();
}
}

Expand Down Expand Up @@ -153,7 +153,7 @@ private string ParseCapabilitiesIfUNIX()
{
if (typeof(bool).IsAssignableFrom(value.GetType()))
{
value = Convert.ToString(value).ToLower();
value = Convert.ToString(value).ToLowerInvariant();
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Appium.Net/Appium/iOS/IOSStartScreenRecordingOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public enum VideoType
/// <returns>self instance for chaining.</returns>
public IOSStartScreenRecordingOptions WithVideoType(VideoType videoType)
{
Parameters["videoType"] = videoType.ToString().ToLower();
Parameters["videoType"] = videoType.ToString().ToLowerInvariant();
return this;
}

Expand Down Expand Up @@ -54,7 +54,7 @@ public enum VideoQuality
/// <returns></returns>
public IOSStartScreenRecordingOptions WithVideoQuality(VideoQuality videoQuality)
{
Parameters["videoQuality"] = videoQuality.ToString().ToLower();
Parameters["videoQuality"] = videoQuality.ToString().ToLowerInvariant();
return this;
}

Expand Down
2 changes: 1 addition & 1 deletion test/integration/helpers/Env.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private static void Init()

private static bool IsTrue(object val)
{
val = val?.ToString().ToLower().Trim();
val = val?.ToString().ToLowerInvariant().Trim();
return val.Equals("true") || val.Equals("1");
}

Expand Down