File tree Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using Xunit ;
3
+ using k8s ;
4
+ using System . IO ;
5
+
6
+ namespace k8s . Tests
7
+ {
8
+ public class KubernetesClientCredentialsTests
9
+ {
10
+ /// <summary>
11
+ /// Checks that a ArgumentNullException is thrown when trying to create a KubernetesClientCredentials with null token
12
+ /// </summary>
13
+ [ Fact ]
14
+ public void TokenNull ( )
15
+ {
16
+ Assert . Throws < ArgumentNullException > ( ( ) => new KubernetesClientCredentials ( null ) ) ;
17
+ }
18
+
19
+ /// <summary>
20
+ /// Checks that a ArgumentNullException is thrown when trying to create a KubernetesClientCredentials with null username
21
+ /// </summary>
22
+ [ Fact ]
23
+ public void UsernameNull ( )
24
+ {
25
+ Assert . Throws < ArgumentNullException > ( ( ) => new KubernetesClientCredentials ( null , "password" ) ) ;
26
+ }
27
+
28
+ /// <summary>
29
+ /// Checks that a ArgumentNullException is thrown when trying to create a KubernetesClientCredentials with null password
30
+ /// </summary>
31
+ [ Fact ]
32
+ public void PasswordNull ( )
33
+ {
34
+ Assert . Throws < ArgumentNullException > ( ( ) => new KubernetesClientCredentials ( "username" , null ) ) ;
35
+ }
36
+
37
+ /// <summary>
38
+ /// Checks that the Token is set with no exceptions
39
+ /// </summary>
40
+ [ Fact ]
41
+ public void ValidTokenIsSet ( )
42
+ {
43
+ var token = "mytoken" ;
44
+ var credentials = new KubernetesClientCredentials ( token ) ;
45
+ Assert . NotNull ( credentials ) ;
46
+ }
47
+
48
+ /// <summary>
49
+ /// Checks that the Username and Password is set with no exceptions
50
+ /// </summary>
51
+ [ Fact ]
52
+ public void ValidUserPasswordIsSet ( )
53
+ {
54
+ var username = "myuser" ;
55
+ var password = "mypassword" ;
56
+ var credentials = new KubernetesClientCredentials ( username , password ) ;
57
+ Assert . NotNull ( credentials ) ;
58
+ }
59
+ }
60
+ }
You can’t perform that action at this time.
0 commit comments