tintoy / dotnet-kube-client

A Kubernetes API client for .NET Standard / .NET Core
MIT License
192 stars 33 forks source link

Made mocking better possible. #61

Closed MarcelRoozekrans closed 5 years ago

MarcelRoozekrans commented 5 years ago

Made mocking better possible by having interface in the kubeClient.ResourceClient<T> instead of the implementation.

Example:

       var kubeClient = new Mock<IKubeApiClient>();
       var secretClient = new Mock<ISecretClientV1>();
       secretClient.Setup(x => x.Create(It.IsAny<SecretV1>(), It.IsAny<CancellationToken>())).ReturnsAsync(new SecretV1());
       kubeClient.Setup(x => x.ResourceClient(It.IsAny<Func<IKubeApiClient, ISecretClientV1>>())).Returns(() => secretClient.Object);
tintoy commented 5 years ago

Hi, thanks! I’m overseas for the next few days with no laptop and patchy internet access - I’ll look at this as soon as I get back :)

MarcelRoozekrans commented 5 years ago

Thnx !

tintoy commented 5 years ago

Thanks!