/// <summary>Snippet for GetNotificationChannelVerificationCode</summary> public void GetNotificationChannelVerificationCode() { // Snippet: GetNotificationChannelVerificationCode(NotificationChannelName,CallSettings) // Create client NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.Create(); // Initialize request argument(s) NotificationChannelName name = new NotificationChannelName("[PROJECT]", "[NOTIFICATION_CHANNEL]"); // Make the request GetNotificationChannelVerificationCodeResponse response = notificationChannelServiceClient.GetNotificationChannelVerificationCode(name); // End snippet }
/// <summary>Snippet for GetNotificationChannelVerificationCodeAsync</summary> public async Task GetNotificationChannelVerificationCodeAsync() { // Snippet: GetNotificationChannelVerificationCodeAsync(NotificationChannelName,CallSettings) // Additional: GetNotificationChannelVerificationCodeAsync(NotificationChannelName,CancellationToken) // Create client NotificationChannelServiceClient notificationChannelServiceClient = await NotificationChannelServiceClient.CreateAsync(); // Initialize request argument(s) NotificationChannelName name = new NotificationChannelName("[PROJECT]", "[NOTIFICATION_CHANNEL]"); // Make the request GetNotificationChannelVerificationCodeResponse response = await notificationChannelServiceClient.GetNotificationChannelVerificationCodeAsync(name); // End snippet }
public async Task GetNotificationChannelVerificationCodeAsync2() { Mock <NotificationChannelService.NotificationChannelServiceClient> mockGrpcClient = new Mock <NotificationChannelService.NotificationChannelServiceClient>(MockBehavior.Strict); GetNotificationChannelVerificationCodeRequest request = new GetNotificationChannelVerificationCodeRequest { NotificationChannelName = new NotificationChannelName("[PROJECT]", "[NOTIFICATION_CHANNEL]"), }; GetNotificationChannelVerificationCodeResponse expectedResponse = new GetNotificationChannelVerificationCodeResponse { Code = "code3059181", }; mockGrpcClient.Setup(x => x.GetNotificationChannelVerificationCodeAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <GetNotificationChannelVerificationCodeResponse>(Task.FromResult(expectedResponse), null, null, null, null)); NotificationChannelServiceClient client = new NotificationChannelServiceClientImpl(mockGrpcClient.Object, null); GetNotificationChannelVerificationCodeResponse response = await client.GetNotificationChannelVerificationCodeAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetNotificationChannelVerificationCode2() { Mock <NotificationChannelService.NotificationChannelServiceClient> mockGrpcClient = new Mock <NotificationChannelService.NotificationChannelServiceClient>(MockBehavior.Strict); GetNotificationChannelVerificationCodeRequest request = new GetNotificationChannelVerificationCodeRequest { NotificationChannelName = new NotificationChannelName("[PROJECT]", "[NOTIFICATION_CHANNEL]"), }; GetNotificationChannelVerificationCodeResponse expectedResponse = new GetNotificationChannelVerificationCodeResponse { Code = "code3059181", }; mockGrpcClient.Setup(x => x.GetNotificationChannelVerificationCode(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); NotificationChannelServiceClient client = new NotificationChannelServiceClientImpl(mockGrpcClient.Object, null); GetNotificationChannelVerificationCodeResponse response = client.GetNotificationChannelVerificationCode(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }