/// <summary>Snippet for GetNotificationChannelDescriptor</summary> public void GetNotificationChannelDescriptor_RequestObject() { // Snippet: GetNotificationChannelDescriptor(GetNotificationChannelDescriptorRequest,CallSettings) // Create client NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.Create(); // Initialize request argument(s) GetNotificationChannelDescriptorRequest request = new GetNotificationChannelDescriptorRequest { NotificationChannelDescriptorName = new NotificationChannelDescriptorName("[PROJECT]", "[CHANNEL_DESCRIPTOR]"), }; // Make the request NotificationChannelDescriptor response = notificationChannelServiceClient.GetNotificationChannelDescriptor(request); // End snippet }
/// <summary>Snippet for GetNotificationChannelDescriptorAsync</summary> public async Task GetNotificationChannelDescriptorAsync_RequestObject() { // Snippet: GetNotificationChannelDescriptorAsync(GetNotificationChannelDescriptorRequest,CallSettings) // Additional: GetNotificationChannelDescriptorAsync(GetNotificationChannelDescriptorRequest,CancellationToken) // Create client NotificationChannelServiceClient notificationChannelServiceClient = await NotificationChannelServiceClient.CreateAsync(); // Initialize request argument(s) GetNotificationChannelDescriptorRequest request = new GetNotificationChannelDescriptorRequest { NotificationChannelDescriptorName = new NotificationChannelDescriptorName("[PROJECT]", "[CHANNEL_DESCRIPTOR]"), }; // Make the request NotificationChannelDescriptor response = await notificationChannelServiceClient.GetNotificationChannelDescriptorAsync(request); // End snippet }
public void GetNotificationChannelDescriptor2() { Mock <NotificationChannelService.NotificationChannelServiceClient> mockGrpcClient = new Mock <NotificationChannelService.NotificationChannelServiceClient>(MockBehavior.Strict); GetNotificationChannelDescriptorRequest request = new GetNotificationChannelDescriptorRequest { NotificationChannelDescriptorName = new NotificationChannelDescriptorName("[PROJECT]", "[CHANNEL_DESCRIPTOR]"), }; NotificationChannelDescriptor expectedResponse = new NotificationChannelDescriptor { Name = "name2-1052831874", Type = "type3575610", DisplayName = "displayName1615086568", Description = "description-1724546052", }; mockGrpcClient.Setup(x => x.GetNotificationChannelDescriptor(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); NotificationChannelServiceClient client = new NotificationChannelServiceClientImpl(mockGrpcClient.Object, null); NotificationChannelDescriptor response = client.GetNotificationChannelDescriptor(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task GetNotificationChannelDescriptorAsync() { Mock <NotificationChannelService.NotificationChannelServiceClient> mockGrpcClient = new Mock <NotificationChannelService.NotificationChannelServiceClient>(MockBehavior.Strict); GetNotificationChannelDescriptorRequest expectedRequest = new GetNotificationChannelDescriptorRequest { NotificationChannelDescriptorName = new NotificationChannelDescriptorName("[PROJECT]", "[CHANNEL_DESCRIPTOR]"), }; NotificationChannelDescriptor expectedResponse = new NotificationChannelDescriptor { Name = "name2-1052831874", Type = "type3575610", DisplayName = "displayName1615086568", Description = "description-1724546052", }; mockGrpcClient.Setup(x => x.GetNotificationChannelDescriptorAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <NotificationChannelDescriptor>(Task.FromResult(expectedResponse), null, null, null, null)); NotificationChannelServiceClient client = new NotificationChannelServiceClientImpl(mockGrpcClient.Object, null); NotificationChannelDescriptorName name = new NotificationChannelDescriptorName("[PROJECT]", "[CHANNEL_DESCRIPTOR]"); NotificationChannelDescriptor response = await client.GetNotificationChannelDescriptorAsync(name); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }