@@ -17,9 +17,18 @@ public class GenericHostProviderTests
17
17
[ InlineData ( "https" , true ) ]
18
18
[ InlineData ( "HTTPS" , true ) ]
19
19
[ 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 ) ]
23
32
[ InlineData ( "" , false ) ]
24
33
[ InlineData ( null , false ) ]
25
34
public void GenericHostProvider_IsSupported ( string protocol , bool expected )
@@ -90,7 +99,6 @@ public async Task GenericHostProvider_CreateCredentialAsync_WiaNotAllowed_Return
90
99
basicAuthMock . Verify ( x => x . GetCredentials ( It . IsAny < string > ( ) , It . IsAny < string > ( ) ) , Times . Once ) ;
91
100
}
92
101
93
-
94
102
[ Fact ]
95
103
public async Task GenericHostProvider_CreateCredentialAsync_LegacyAuthorityBasic_ReturnsBasicCredentialNoWiaCheck ( )
96
104
{
@@ -125,6 +133,37 @@ public async Task GenericHostProvider_CreateCredentialAsync_LegacyAuthorityBasic
125
133
basicAuthMock . Verify ( x => x . GetCredentials ( It . IsAny < string > ( ) , It . IsAny < string > ( ) ) , Times . Once ) ;
126
134
}
127
135
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
+
128
167
[ PlatformFact ( Platforms . Posix ) ]
129
168
public async Task GenericHostProvider_CreateCredentialAsync_NonWindows_WiaSupported_ReturnsBasicCredential ( )
130
169
{
0 commit comments