Exemplo n.º 1
0
        public async Task VerifyNotificationChannelAsync()
        {
            Mock <NotificationChannelService.NotificationChannelServiceClient> mockGrpcClient = new Mock <NotificationChannelService.NotificationChannelServiceClient>(MockBehavior.Strict);
            VerifyNotificationChannelRequest expectedRequest = new VerifyNotificationChannelRequest
            {
                NotificationChannelName = new NotificationChannelName("[PROJECT]", "[NOTIFICATION_CHANNEL]"),
                Code = "code3059181",
            };
            NotificationChannel expectedResponse = new NotificationChannel
            {
                Type        = "type3575610",
                Name        = "name2-1052831874",
                DisplayName = "displayName1615086568",
                Description = "description-1724546052",
            };

            mockGrpcClient.Setup(x => x.VerifyNotificationChannelAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <NotificationChannel>(Task.FromResult(expectedResponse), null, null, null, null));
            NotificationChannelServiceClient client = new NotificationChannelServiceClientImpl(mockGrpcClient.Object, null);
            NotificationChannelName          name   = new NotificationChannelName("[PROJECT]", "[NOTIFICATION_CHANNEL]");
            string code = "code3059181";
            NotificationChannel response = await client.VerifyNotificationChannelAsync(name, code);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 2
0
 /// <summary>Snippet for VerifyNotificationChannel</summary>
 public void VerifyNotificationChannel_RequestObject()
 {
     // Snippet: VerifyNotificationChannel(VerifyNotificationChannelRequest,CallSettings)
     // Create client
     NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.Create();
     // Initialize request argument(s)
     VerifyNotificationChannelRequest request = new VerifyNotificationChannelRequest
     {
         NotificationChannelName = new NotificationChannelName("[PROJECT]", "[NOTIFICATION_CHANNEL]"),
         Code = "",
     };
     // Make the request
     NotificationChannel response = notificationChannelServiceClient.VerifyNotificationChannel(request);
     // End snippet
 }
Exemplo n.º 3
0
        /// <summary>Snippet for VerifyNotificationChannelAsync</summary>
        public async Task VerifyNotificationChannelAsync_RequestObject()
        {
            // Snippet: VerifyNotificationChannelAsync(VerifyNotificationChannelRequest,CallSettings)
            // Additional: VerifyNotificationChannelAsync(VerifyNotificationChannelRequest,CancellationToken)
            // Create client
            NotificationChannelServiceClient notificationChannelServiceClient = await NotificationChannelServiceClient.CreateAsync();

            // Initialize request argument(s)
            VerifyNotificationChannelRequest request = new VerifyNotificationChannelRequest
            {
                NotificationChannelName = new NotificationChannelName("[PROJECT]", "[NOTIFICATION_CHANNEL]"),
                Code = "",
            };
            // Make the request
            NotificationChannel response = await notificationChannelServiceClient.VerifyNotificationChannelAsync(request);

            // End snippet
        }
Exemplo n.º 4
0
        public void VerifyNotificationChannel2()
        {
            Mock <NotificationChannelService.NotificationChannelServiceClient> mockGrpcClient = new Mock <NotificationChannelService.NotificationChannelServiceClient>(MockBehavior.Strict);
            VerifyNotificationChannelRequest request = new VerifyNotificationChannelRequest
            {
                NotificationChannelName = new NotificationChannelName("[PROJECT]", "[NOTIFICATION_CHANNEL]"),
                Code = "code3059181",
            };
            NotificationChannel expectedResponse = new NotificationChannel
            {
                Type        = "type3575610",
                Name        = "name2-1052831874",
                DisplayName = "displayName1615086568",
                Description = "description-1724546052",
            };

            mockGrpcClient.Setup(x => x.VerifyNotificationChannel(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            NotificationChannelServiceClient client = new NotificationChannelServiceClientImpl(mockGrpcClient.Object, null);
            NotificationChannel response            = client.VerifyNotificationChannel(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }