Ejemplo n.º 1
0
        public async stt::Task DeleteUnsubscriberResourceNamesAsync()
        {
            moq::Mock <Unsubscribers.UnsubscribersClient> mockGrpcClient = new moq::Mock <Unsubscribers.UnsubscribersClient>(moq::MockBehavior.Strict);
            DeleteUnsubscriberRequest request = new DeleteUnsubscriberRequest
            {
                UnsubscriberName = UnsubscriberName.FromProjectUnsubscriber("[PROJECT]", "[UNSUBSCRIBER]"),
            };
            Unsubscriber expectedResponse = new Unsubscriber
            {
                UnsubscriberName  = UnsubscriberName.FromProjectUnsubscriber("[PROJECT]", "[UNSUBSCRIBER]"),
                Phone             = "phonee72fa4f7",
                UnsubscribeMethod = Unsubscriber.Types.UnsubscribeMethod.Unspecified,
                Labels            =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                CreateTime = new wkt::Timestamp(),
            };

            mockGrpcClient.Setup(x => x.DeleteUnsubscriberAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Unsubscriber>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            UnsubscribersClient client = new UnsubscribersClientImpl(mockGrpcClient.Object, null);
            Unsubscriber        responseCallSettings = await client.DeleteUnsubscriberAsync(request.UnsubscriberName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Unsubscriber responseCancellationToken = await client.DeleteUnsubscriberAsync(request.UnsubscriberName, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 2
0
        public void DeleteUnsubscriberResourceNames()
        {
            moq::Mock <Unsubscribers.UnsubscribersClient> mockGrpcClient = new moq::Mock <Unsubscribers.UnsubscribersClient>(moq::MockBehavior.Strict);
            DeleteUnsubscriberRequest request = new DeleteUnsubscriberRequest
            {
                UnsubscriberName = UnsubscriberName.FromProjectUnsubscriber("[PROJECT]", "[UNSUBSCRIBER]"),
            };
            Unsubscriber expectedResponse = new Unsubscriber
            {
                UnsubscriberName  = UnsubscriberName.FromProjectUnsubscriber("[PROJECT]", "[UNSUBSCRIBER]"),
                Phone             = "phonee72fa4f7",
                UnsubscribeMethod = Unsubscriber.Types.UnsubscribeMethod.Unspecified,
                Labels            =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                CreateTime = new wkt::Timestamp(),
            };

            mockGrpcClient.Setup(x => x.DeleteUnsubscriber(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            UnsubscribersClient client   = new UnsubscribersClientImpl(mockGrpcClient.Object, null);
            Unsubscriber        response = client.DeleteUnsubscriber(request.UnsubscriberName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 3
0
 /// <summary>Snippet for DeleteUnsubscriber</summary>
 public void DeleteUnsubscriberRequestObject()
 {
     // Snippet: DeleteUnsubscriber(DeleteUnsubscriberRequest, CallSettings)
     // Create client
     UnsubscribersClient unsubscribersClient = UnsubscribersClient.Create();
     // Initialize request argument(s)
     DeleteUnsubscriberRequest request = new DeleteUnsubscriberRequest
     {
         UnsubscriberName = UnsubscriberName.FromProjectUnsubscriber("[PROJECT]", "[UNSUBSCRIBER]"),
     };
     // Make the request
     Unsubscriber response = unsubscribersClient.DeleteUnsubscriber(request);
     // End snippet
 }
Ejemplo n.º 4
0
        /// <summary>Snippet for DeleteUnsubscriberAsync</summary>
        public async Task DeleteUnsubscriberRequestObjectAsync()
        {
            // Snippet: DeleteUnsubscriberAsync(DeleteUnsubscriberRequest, CallSettings)
            // Additional: DeleteUnsubscriberAsync(DeleteUnsubscriberRequest, CancellationToken)
            // Create client
            UnsubscribersClient unsubscribersClient = await UnsubscribersClient.CreateAsync();

            // Initialize request argument(s)
            DeleteUnsubscriberRequest request = new DeleteUnsubscriberRequest
            {
                UnsubscriberName = UnsubscriberName.FromProjectUnsubscriber("[PROJECT]", "[UNSUBSCRIBER]"),
            };
            // Make the request
            Unsubscriber response = await unsubscribersClient.DeleteUnsubscriberAsync(request);

            // End snippet
        }