public async Task UpdateExclusionAsync2() { Mock <ConfigServiceV2.ConfigServiceV2Client> mockGrpcClient = new Mock <ConfigServiceV2.ConfigServiceV2Client>(MockBehavior.Strict); UpdateExclusionRequest request = new UpdateExclusionRequest { ExclusionNameOneof = ExclusionNameOneof.From(new ExclusionName("[PROJECT]", "[EXCLUSION]")), Exclusion = new LogExclusion(), UpdateMask = new FieldMask(), }; LogExclusion expectedResponse = new LogExclusion { Name = "name2-1052831874", Description = "description-1724546052", Filter = "filter-1274492040", Disabled = true, }; mockGrpcClient.Setup(x => x.UpdateExclusionAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <LogExclusion>(Task.FromResult(expectedResponse), null, null, null, null)); ConfigServiceV2Client client = new ConfigServiceV2ClientImpl(mockGrpcClient.Object, null); LogExclusion response = await client.UpdateExclusionAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void UpdateExclusion() { Mock <ConfigServiceV2.ConfigServiceV2Client> mockGrpcClient = new Mock <ConfigServiceV2.ConfigServiceV2Client>(MockBehavior.Strict); UpdateExclusionRequest expectedRequest = new UpdateExclusionRequest { ExclusionNameOneof = ExclusionNameOneof.From(new ExclusionName("[PROJECT]", "[EXCLUSION]")), Exclusion = new LogExclusion(), UpdateMask = new FieldMask(), }; LogExclusion expectedResponse = new LogExclusion { Name = "name2-1052831874", Description = "description-1724546052", Filter = "filter-1274492040", Disabled = true, }; mockGrpcClient.Setup(x => x.UpdateExclusion(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); ConfigServiceV2Client client = new ConfigServiceV2ClientImpl(mockGrpcClient.Object, null); ExclusionNameOneof name = ExclusionNameOneof.From(new ExclusionName("[PROJECT]", "[EXCLUSION]")); LogExclusion exclusion = new LogExclusion(); FieldMask updateMask = new FieldMask(); LogExclusion response = client.UpdateExclusion(name, exclusion, updateMask); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for UpdateExclusion</summary> public void UpdateExclusion_RequestObject() { // Snippet: UpdateExclusion(UpdateExclusionRequest,CallSettings) // Create client ConfigServiceV2Client configServiceV2Client = ConfigServiceV2Client.Create(); // Initialize request argument(s) UpdateExclusionRequest request = new UpdateExclusionRequest { ExclusionNameOneof = ExclusionNameOneof.From(new ExclusionName("[PROJECT]", "[EXCLUSION]")), Exclusion = new LogExclusion(), UpdateMask = new FieldMask(), }; // Make the request LogExclusion response = configServiceV2Client.UpdateExclusion(request); // End snippet }
/// <summary>Snippet for UpdateExclusionAsync</summary> public async Task UpdateExclusionAsync_RequestObject() { // Snippet: UpdateExclusionAsync(UpdateExclusionRequest,CallSettings) // Additional: UpdateExclusionAsync(UpdateExclusionRequest,CancellationToken) // Create client ConfigServiceV2Client configServiceV2Client = await ConfigServiceV2Client.CreateAsync(); // Initialize request argument(s) UpdateExclusionRequest request = new UpdateExclusionRequest { ExclusionNameOneof = ExclusionNameOneof.From(new ExclusionName("[PROJECT]", "[EXCLUSION]")), Exclusion = new LogExclusion(), UpdateMask = new FieldMask(), }; // Make the request LogExclusion response = await configServiceV2Client.UpdateExclusionAsync(request); // End snippet }