Пример #1
0
        public async Task DeleteSshPublicKeyAsync2()
        {
            Mock <OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock <OsLoginService.OsLoginServiceClient>(MockBehavior.Strict);
            DeleteSshPublicKeyRequest request = new DeleteSshPublicKeyRequest
            {
                FingerprintName = new FingerprintName("[USER]", "[FINGERPRINT]"),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteSshPublicKeyAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null));
            OsLoginServiceClient client = new OsLoginServiceClientImpl(mockGrpcClient.Object, null);
            await client.DeleteSshPublicKeyAsync(request);

            mockGrpcClient.VerifyAll();
        }
        /// <summary>Snippet for DeleteSshPublicKeyAsync</summary>
        public async Task DeleteSshPublicKeyAsync_RequestObject()
        {
            // Snippet: DeleteSshPublicKeyAsync(DeleteSshPublicKeyRequest,CallSettings)
            // Create client
            OsLoginServiceClient osLoginServiceClient = await OsLoginServiceClient.CreateAsync();

            // Initialize request argument(s)
            DeleteSshPublicKeyRequest request = new DeleteSshPublicKeyRequest
            {
                FingerprintName = new FingerprintName("[USER]", "[FINGERPRINT]"),
            };
            // Make the request
            await osLoginServiceClient.DeleteSshPublicKeyAsync(request);

            // End snippet
        }
Пример #3
0
        public void DeleteSshPublicKey2()
        {
            Mock <OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock <OsLoginService.OsLoginServiceClient>(MockBehavior.Strict);
            DeleteSshPublicKeyRequest request = new DeleteSshPublicKeyRequest
            {
                FingerprintName = new FingerprintName("[USER]", "[FINGERPRINT]"),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteSshPublicKey(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            OsLoginServiceClient client = new OsLoginServiceClientImpl(mockGrpcClient.Object, null);

            client.DeleteSshPublicKey(request);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>Snippet for DeleteSshPublicKeyAsync</summary>
        public async Task DeleteSshPublicKeyRequestObjectAsync()
        {
            // Snippet: DeleteSshPublicKeyAsync(DeleteSshPublicKeyRequest, CallSettings)
            // Additional: DeleteSshPublicKeyAsync(DeleteSshPublicKeyRequest, CancellationToken)
            // Create client
            OsLoginServiceClient osLoginServiceClient = await OsLoginServiceClient.CreateAsync();

            // Initialize request argument(s)
            DeleteSshPublicKeyRequest request = new DeleteSshPublicKeyRequest
            {
                SshPublicKeyName = SshPublicKeyName.FromUserFingerprint("[USER]", "[FINGERPRINT]"),
            };
            // Make the request
            await osLoginServiceClient.DeleteSshPublicKeyAsync(request);

            // End snippet
        }