public async Task UpdateNotificationChannelAsync() { Mock <NotificationChannelService.NotificationChannelServiceClient> mockGrpcClient = new Mock <NotificationChannelService.NotificationChannelServiceClient>(MockBehavior.Strict); UpdateNotificationChannelRequest expectedRequest = new UpdateNotificationChannelRequest { UpdateMask = new FieldMask(), NotificationChannel = new NotificationChannel(), }; NotificationChannel expectedResponse = new NotificationChannel { Type = "type3575610", Name = "name3373707", DisplayName = "displayName1615086568", Description = "description-1724546052", }; mockGrpcClient.Setup(x => x.UpdateNotificationChannelAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <NotificationChannel>(Task.FromResult(expectedResponse), null, null, null, null)); NotificationChannelServiceClient client = new NotificationChannelServiceClientImpl(mockGrpcClient.Object, null); FieldMask updateMask = new FieldMask(); NotificationChannel notificationChannel = new NotificationChannel(); NotificationChannel response = await client.UpdateNotificationChannelAsync(updateMask, notificationChannel); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for UpdateNotificationChannel</summary> public void UpdateNotificationChannel_RequestObject() { // Snippet: UpdateNotificationChannel(UpdateNotificationChannelRequest,CallSettings) // Create client NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.Create(); // Initialize request argument(s) UpdateNotificationChannelRequest request = new UpdateNotificationChannelRequest { NotificationChannel = new NotificationChannel(), }; // Make the request NotificationChannel response = notificationChannelServiceClient.UpdateNotificationChannel(request); // End snippet }
/// <summary>Snippet for UpdateNotificationChannelAsync</summary> public async Task UpdateNotificationChannelAsync_RequestObject() { // Snippet: UpdateNotificationChannelAsync(UpdateNotificationChannelRequest,CallSettings) // Additional: UpdateNotificationChannelAsync(UpdateNotificationChannelRequest,CancellationToken) // Create client NotificationChannelServiceClient notificationChannelServiceClient = await NotificationChannelServiceClient.CreateAsync(); // Initialize request argument(s) UpdateNotificationChannelRequest request = new UpdateNotificationChannelRequest { NotificationChannel = new NotificationChannel(), }; // Make the request NotificationChannel response = await notificationChannelServiceClient.UpdateNotificationChannelAsync(request); // End snippet }
public void UpdateNotificationChannel2() { Mock <NotificationChannelService.NotificationChannelServiceClient> mockGrpcClient = new Mock <NotificationChannelService.NotificationChannelServiceClient>(MockBehavior.Strict); UpdateNotificationChannelRequest request = new UpdateNotificationChannelRequest { NotificationChannel = new NotificationChannel(), }; NotificationChannel expectedResponse = new NotificationChannel { Type = "type3575610", Name = "name3373707", DisplayName = "displayName1615086568", Description = "description-1724546052", }; mockGrpcClient.Setup(x => x.UpdateNotificationChannel(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); NotificationChannelServiceClient client = new NotificationChannelServiceClientImpl(mockGrpcClient.Object, null); NotificationChannel response = client.UpdateNotificationChannel(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }