Merge pull request #5 from sesispla/master
Added basic XUnit project structure
This commit is contained in:
12
README.md
12
README.md
@@ -27,3 +27,15 @@ npm install autorest
|
|||||||
cd ${REPO_DIR}/csharp/src
|
cd ${REPO_DIR}/csharp/src
|
||||||
${GEN_DIR}/openapi/csharp.sh generated csharp.settings
|
${GEN_DIR}/openapi/csharp.sh generated csharp.settings
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Testing
|
||||||
|
|
||||||
|
The project uses [XUnit](https://xunit.github.io) as unit testing framework.
|
||||||
|
|
||||||
|
To run the tests you need to:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd tests
|
||||||
|
dotnet restore
|
||||||
|
dotnet xunit
|
||||||
|
```
|
||||||
32
tests/KubernetesClientConfigurationTests.cs
Executable file
32
tests/KubernetesClientConfigurationTests.cs
Executable file
@@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using Xunit;
|
||||||
|
using k8s;
|
||||||
|
|
||||||
|
namespace k8s.Tests
|
||||||
|
{
|
||||||
|
public class KubernetesClientConfigurationTests
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Checks Host is loaded from the default configuration file
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void DefaultConfigurationLoaded()
|
||||||
|
{
|
||||||
|
var cfg = new KubernetesClientConfiguration();
|
||||||
|
Assert.NotNull(cfg.Host);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if the are pods
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public void ListDefaultNamespacedPod()
|
||||||
|
{
|
||||||
|
var k8sClientConfig = new KubernetesClientConfiguration();
|
||||||
|
IKubernetes client = new Kubernetes(k8sClientConfig);
|
||||||
|
var listTask = client.ListNamespacedPodWithHttpMessagesAsync("default").Result;
|
||||||
|
var list = listTask.Body;
|
||||||
|
Assert.NotEqual(0, list.Items.Count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
16
tests/tests.csproj
Executable file
16
tests/tests.csproj
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="xunit" Version="2.3.0-beta3-build3705" />
|
||||||
|
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta3-build3705" />
|
||||||
|
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="3.0.3" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
|
||||||
|
<PackageReference Include="YamlDotNet.NetCore" Version="1.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\src\KubernetesClient.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
Reference in New Issue
Block a user