public async Task CreateCustomResourceDefinitionAsync_UsesProtocol_Async() { var crd = new V1CustomResourceDefinition() { Metadata = new V1ObjectMeta() { Name = "my-crd" } }; var protocol = new Mock <IKubernetesProtocol>(MockBehavior.Strict); protocol .Setup(p => p.CreateCustomResourceDefinitionWithHttpMessagesAsync(crd, null, null, null, null, default)) .ReturnsAsync(new HttpOperationResponse <V1CustomResourceDefinition>() { Body = crd }); protocol.Setup(p => p.Dispose()).Verifiable(); using (var client = new KubernetesClient(protocol.Object, KubernetesOptions.Default, NullLogger <KubernetesClient> .Instance, NullLoggerFactory.Instance)) { var result = await client.CreateCustomResourceDefinitionAsync(crd, default).ConfigureAwait(false); Assert.Same(crd, result); } }
public async Task CreateCustomResourceDefinitionAsync_ValidatesArguments_Async() { var protocol = new Mock <IKubernetesProtocol>(MockBehavior.Strict); protocol.Setup(p => p.Dispose()).Verifiable(); using (var client = new KubernetesClient(protocol.Object, KubernetesOptions.Default, NullLogger <KubernetesClient> .Instance, NullLoggerFactory.Instance)) { await Assert.ThrowsAsync <ArgumentNullException>("value", () => client.CreateCustomResourceDefinitionAsync(null, default)).ConfigureAwait(false); } }