File tree Expand file tree Collapse file tree 3 files changed +60
-0
lines changed Expand file tree Collapse file tree 3 files changed +60
-0
lines changed Original file line number Diff line number Diff line change @@ -27,3 +27,15 @@ npm install autorest
27
27
cd ${REPO_DIR}/csharp/src
28
28
${GEN_DIR}/openapi/csharp.sh generated csharp.settings
29
29
```
30
+
31
+ # Testing
32
+
33
+ The project uses [ XUnit] ( https://xunit.github.io ) as unit testing framework.
34
+
35
+ To run the tests you need to:
36
+
37
+ ``` bash
38
+ cd tests
39
+ dotnet restore
40
+ dotnet xunit
41
+ ```
Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using Xunit ;
3
+ using k8s ;
4
+
5
+ namespace k8s . Tests
6
+ {
7
+ public class KubernetesClientConfigurationTests
8
+ {
9
+ /// <summary>
10
+ /// Checks Host is loaded from the default configuration file
11
+ /// </summary>
12
+ [ Fact ]
13
+ public void DefaultConfigurationLoaded ( )
14
+ {
15
+ var cfg = new KubernetesClientConfiguration ( ) ;
16
+ Assert . NotNull ( cfg . Host ) ;
17
+ }
18
+
19
+ /// <summary>
20
+ /// Checks if the are pods
21
+ /// </summary>
22
+ [ Fact ]
23
+ public void ListDefaultNamespacedPod ( )
24
+ {
25
+ var k8sClientConfig = new KubernetesClientConfiguration ( ) ;
26
+ IKubernetes client = new Kubernetes ( k8sClientConfig ) ;
27
+ var listTask = client . ListNamespacedPodWithHttpMessagesAsync ( "default" ) . Result ;
28
+ var list = listTask . Body ;
29
+ Assert . NotEqual ( 0 , list . Items . Count ) ;
30
+ }
31
+ }
32
+ }
Original file line number Diff line number Diff line change
1
+ <Project Sdk =" Microsoft.NET.Sdk" >
2
+ <PropertyGroup >
3
+ <TargetFramework >netcoreapp1.1</TargetFramework >
4
+ <IsPackable >false</IsPackable >
5
+ </PropertyGroup >
6
+ <ItemGroup >
7
+ <PackageReference Include =" xunit" Version =" 2.3.0-beta3-build3705" />
8
+ <DotNetCliToolReference Include =" dotnet-xunit" Version =" 2.3.0-beta3-build3705" />
9
+ <PackageReference Include =" Microsoft.Rest.ClientRuntime" Version =" 3.0.3" />
10
+ <PackageReference Include =" Newtonsoft.Json" Version =" 10.0.2" />
11
+ <PackageReference Include =" YamlDotNet.NetCore" Version =" 1.0.0" />
12
+ </ItemGroup >
13
+ <ItemGroup >
14
+ <ProjectReference Include =" ..\src\KubernetesClient.csproj" />
15
+ </ItemGroup >
16
+ </Project >
You can’t perform that action at this time.
0 commit comments