public async Task UpdateSshPublicKeyAsync2()
        {
            Mock <OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock <OsLoginService.OsLoginServiceClient>(MockBehavior.Strict);
            UpdateSshPublicKeyRequest expectedRequest = new UpdateSshPublicKeyRequest
            {
                FingerprintName = new FingerprintName("[USER]", "[FINGERPRINT]"),
                SshPublicKey    = new SshPublicKey(),
                UpdateMask      = new FieldMask(),
            };
            SshPublicKey expectedResponse = new SshPublicKey
            {
                Key = "key106079",
                ExpirationTimeUsec = 2058878882L,
                Fingerprint        = "fingerprint-1375934236",
            };

            mockGrpcClient.Setup(x => x.UpdateSshPublicKeyAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <SshPublicKey>(Task.FromResult(expectedResponse), null, null, null, null));
            OsLoginServiceClient client       = new OsLoginServiceClientImpl(mockGrpcClient.Object, null);
            FingerprintName      name         = new FingerprintName("[USER]", "[FINGERPRINT]");
            SshPublicKey         sshPublicKey = new SshPublicKey();
            FieldMask            updateMask   = new FieldMask();
            SshPublicKey         response     = await client.UpdateSshPublicKeyAsync(name, sshPublicKey, updateMask);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void UpdateSshPublicKey()
        {
            Mock <OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock <OsLoginService.OsLoginServiceClient>(MockBehavior.Strict);
            UpdateSshPublicKeyRequest expectedRequest = new UpdateSshPublicKeyRequest
            {
                FingerprintName = new FingerprintName("[USER]", "[FINGERPRINT]"),
                SshPublicKey    = new SshPublicKey(),
            };
            SshPublicKey expectedResponse = new SshPublicKey
            {
                Key = "key106079",
                ExpirationTimeUsec = 2058878882L,
                Fingerprint        = "fingerprint-1375934236",
            };

            mockGrpcClient.Setup(x => x.UpdateSshPublicKey(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            OsLoginServiceClient client       = new OsLoginServiceClientImpl(mockGrpcClient.Object, null);
            FingerprintName      name         = new FingerprintName("[USER]", "[FINGERPRINT]");
            SshPublicKey         sshPublicKey = new SshPublicKey();
            SshPublicKey         response     = client.UpdateSshPublicKey(name, sshPublicKey);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Пример #3
0
 /// <summary>Snippet for UpdateSshPublicKey</summary>
 public void UpdateSshPublicKey_RequestObject()
 {
     // Snippet: UpdateSshPublicKey(UpdateSshPublicKeyRequest,CallSettings)
     // Create client
     OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.Create();
     // Initialize request argument(s)
     UpdateSshPublicKeyRequest request = new UpdateSshPublicKeyRequest
     {
         FingerprintName = new FingerprintName("[USER]", "[FINGERPRINT]"),
         SshPublicKey    = new SshPublicKey(),
     };
     // Make the request
     SshPublicKey response = osLoginServiceClient.UpdateSshPublicKey(request);
     // End snippet
 }
Пример #4
0
        /// <summary>Snippet for UpdateSshPublicKeyAsync</summary>
        public async Task UpdateSshPublicKeyAsync_RequestObject()
        {
            // Snippet: UpdateSshPublicKeyAsync(UpdateSshPublicKeyRequest,CallSettings)
            // Additional: UpdateSshPublicKeyAsync(UpdateSshPublicKeyRequest,CancellationToken)
            // Create client
            OsLoginServiceClient osLoginServiceClient = await OsLoginServiceClient.CreateAsync();

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

            // End snippet
        }