Esempio n. 1
0
 /// <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
 }
Esempio n. 2
0
        /// <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
        }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
        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();
        }