/// <summary>Snippet for GetCmekSettings</summary> public void GetCmekSettings_RequestObject() { // Snippet: GetCmekSettings(GetCmekSettingsRequest,CallSettings) // Create client ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.Create(); // Initialize request argument(s) GetCmekSettingsRequest request = new GetCmekSettingsRequest(); // Make the request CmekSettings response = configServiceV2Client.GetCmekSettings(request); // End snippet }
/// <summary>Snippet for GetCmekSettingsAsync</summary> public async Task GetCmekSettingsAsync_RequestObject() { // Snippet: GetCmekSettingsAsync(GetCmekSettingsRequest,CallSettings) // Additional: GetCmekSettingsAsync(GetCmekSettingsRequest,CancellationToken) // Create client ConfigServiceV2Client configServiceV2Client = await ConfigServiceV2Client.CreateAsync(); // Initialize request argument(s) GetCmekSettingsRequest request = new GetCmekSettingsRequest(); // Make the request CmekSettings response = await configServiceV2Client.GetCmekSettingsAsync(request); // End snippet }
public async Task GetCmekSettingsAsync() { Mock <ConfigServiceV2.ConfigServiceV2Client> mockGrpcClient = new Mock <ConfigServiceV2.ConfigServiceV2Client>(MockBehavior.Strict); GetCmekSettingsRequest request = new GetCmekSettingsRequest(); CmekSettings expectedResponse = new CmekSettings { Name = "name3373707", KmsKeyName = "kmsKeyName2094986649", ServiceAccountId = "serviceAccountId-111486921", }; mockGrpcClient.Setup(x => x.GetCmekSettingsAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <CmekSettings>(Task.FromResult(expectedResponse), null, null, null, null)); ConfigServiceV2Client client = new ConfigServiceV2ClientImpl(mockGrpcClient.Object, null); CmekSettings response = await client.GetCmekSettingsAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetCmekSettings() { Mock <ConfigServiceV2.ConfigServiceV2Client> mockGrpcClient = new Mock <ConfigServiceV2.ConfigServiceV2Client>(MockBehavior.Strict); GetCmekSettingsRequest request = new GetCmekSettingsRequest(); CmekSettings expectedResponse = new CmekSettings { Name = "name3373707", KmsKeyName = "kmsKeyName2094986649", ServiceAccountId = "serviceAccountId-111486921", }; mockGrpcClient.Setup(x => x.GetCmekSettings(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); ConfigServiceV2Client client = new ConfigServiceV2ClientImpl(mockGrpcClient.Object, null); CmekSettings response = client.GetCmekSettings(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }