@@ -17,9 +17,18 @@ public class GenericHostProviderTests
1717 [ InlineData ( "https" , true ) ]
1818 [ InlineData ( "HTTPS" , true ) ]
1919 [ InlineData ( "hTtPs" , true ) ]
20- [ InlineData ( "ssh" , false ) ]
21- [ InlineData ( "SSH" , false ) ]
22- [ InlineData ( "sSh" , false ) ]
20+ [ InlineData ( "ssh" , true ) ]
21+ [ InlineData ( "SSH" , true ) ]
22+ [ InlineData ( "sSh" , true ) ]
23+ [ InlineData ( "smpt" , true ) ]
24+ [ InlineData ( "SmtP" , true ) ]
25+ [ InlineData ( "SMTP" , true ) ]
26+ [ InlineData ( "imap" , true ) ]
27+ [ InlineData ( "iMAp" , true ) ]
28+ [ InlineData ( "IMAP" , true ) ]
29+ [ InlineData ( "file" , true ) ]
30+ [ InlineData ( "fIlE" , true ) ]
31+ [ InlineData ( "FILE" , true ) ]
2332 [ InlineData ( "" , false ) ]
2433 [ InlineData ( null , false ) ]
2534 public void GenericHostProvider_IsSupported ( string protocol , bool expected )
@@ -90,7 +99,6 @@ public async Task GenericHostProvider_CreateCredentialAsync_WiaNotAllowed_Return
9099 basicAuthMock . Verify ( x => x . GetCredentials ( It . IsAny < string > ( ) , It . IsAny < string > ( ) ) , Times . Once ) ;
91100 }
92101
93-
94102 [ Fact ]
95103 public async Task GenericHostProvider_CreateCredentialAsync_LegacyAuthorityBasic_ReturnsBasicCredentialNoWiaCheck ( )
96104 {
@@ -125,6 +133,37 @@ public async Task GenericHostProvider_CreateCredentialAsync_LegacyAuthorityBasic
125133 basicAuthMock . Verify ( x => x . GetCredentials ( It . IsAny < string > ( ) , It . IsAny < string > ( ) ) , Times . Once ) ;
126134 }
127135
136+ [ Fact ]
137+ public async Task GenericHostProvider_CreateCredentialAsync_NonHttpProtocol_ReturnsBasicCredentialNoWiaCheck ( )
138+ {
139+ var input = new InputArguments ( new Dictionary < string , string >
140+ {
141+ [ "protocol" ] = "smtp" ,
142+ [ "host" ] = "example.com" ,
143+ } ) ;
144+
145+ const string testUserName = "basicUser" ;
146+ const string testPassword = "basicPass" ;
147+ var basicCredential = new GitCredential ( testUserName , testPassword ) ;
148+
149+ var context = new TestCommandContext ( ) ;
150+ var basicAuthMock = new Mock < IBasicAuthentication > ( ) ;
151+ basicAuthMock . Setup ( x => x . GetCredentials ( It . IsAny < string > ( ) , It . IsAny < string > ( ) ) )
152+ . Returns ( basicCredential )
153+ . Verifiable ( ) ;
154+ var wiaAuthMock = new Mock < IWindowsIntegratedAuthentication > ( ) ;
155+
156+ var provider = new GenericHostProvider ( context , basicAuthMock . Object , wiaAuthMock . Object ) ;
157+
158+ ICredential credential = await provider . GenerateCredentialAsync ( input ) ;
159+
160+ Assert . NotNull ( credential ) ;
161+ Assert . Equal ( testUserName , credential . Account ) ;
162+ Assert . Equal ( testPassword , credential . Password ) ;
163+ wiaAuthMock . Verify ( x => x . GetIsSupportedAsync ( It . IsAny < Uri > ( ) ) , Times . Never ) ;
164+ basicAuthMock . Verify ( x => x . GetCredentials ( It . IsAny < string > ( ) , It . IsAny < string > ( ) ) , Times . Once ) ;
165+ }
166+
128167 [ PlatformFact ( Platforms . Posix ) ]
129168 public async Task GenericHostProvider_CreateCredentialAsync_NonWindows_WiaSupported_ReturnsBasicCredential ( )
130169 {
0 commit comments