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 SSH hostname parsing to be case sensitive and refactor remoting methods to static class #20968

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Prev Previous commit
Adding upper case characters to host name tests from PR feedback.
  • Loading branch information
ArmaanMcleod committed May 17, 2024
commit fee498469ed0f76780ddab09694bba12d6a26a21
12 changes: 6 additions & 6 deletions test/xUnit/csharp/test_RemotingUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,29 @@ public void TestParseSshHostname()
[Fact]
public void TestParseSshHostnameWithPort()
{
string hostname = "foo.bar.com:22";
string hostname = "Foo.Bar.com:22";
RemotingUtils.ParseSshHostName(cmdlet, hostname, out string host, out string userName, out int port);
Assert.Equal("foo.bar.com", host);
Assert.Equal("Foo.Bar.com", host);
Assert.Null(userName);
Assert.Equal(22, port);
}

[Fact]
public void TestParseSshHostnameWithUsername()
{
string hostname = "user@foo.bar.com";
string hostname = "user@Foo.Bar.com";
RemotingUtils.ParseSshHostName(cmdlet, hostname, out string host, out string userName, out int port);
Assert.Equal("foo.bar.com", host);
Assert.Equal("Foo.Bar.com", host);
Assert.Equal("user", userName);
Assert.Equal(0, port);
}

[Fact]
public void TestParseSshHostnameWithUsernameAndPort()
{
string hostname = "user@foo.bar.com:22";
string hostname = "user@Foo.Bar.com:22";
RemotingUtils.ParseSshHostName(cmdlet, hostname, out string host, out string userName, out int port);
Assert.Equal("foo.bar.com", host);
Assert.Equal("Foo.Bar.com", host);
Assert.Equal("user", userName);
Assert.Equal(22, port);
}
Expand Down
Loading