public async stt::Task GetUnsubscriberResourceNamesAsync() { moq::Mock <Unsubscribers.UnsubscribersClient> mockGrpcClient = new moq::Mock <Unsubscribers.UnsubscribersClient>(moq::MockBehavior.Strict); GetUnsubscriberRequest request = new GetUnsubscriberRequest { 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.GetUnsubscriberAsync(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.GetUnsubscriberAsync(request.UnsubscriberName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Unsubscriber responseCancellationToken = await client.GetUnsubscriberAsync(request.UnsubscriberName, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetUnsubscriberResourceNames() { moq::Mock <Unsubscribers.UnsubscribersClient> mockGrpcClient = new moq::Mock <Unsubscribers.UnsubscribersClient>(moq::MockBehavior.Strict); GetUnsubscriberRequest request = new GetUnsubscriberRequest { 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.GetUnsubscriber(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); UnsubscribersClient client = new UnsubscribersClientImpl(mockGrpcClient.Object, null); Unsubscriber response = client.GetUnsubscriber(request.UnsubscriberName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GetUnsubscriber</summary> public void GetUnsubscriberRequestObject() { // Snippet: GetUnsubscriber(GetUnsubscriberRequest, CallSettings) // Create client UnsubscribersClient unsubscribersClient = UnsubscribersClient.Create(); // Initialize request argument(s) GetUnsubscriberRequest request = new GetUnsubscriberRequest { UnsubscriberName = UnsubscriberName.FromProjectUnsubscriber("[PROJECT]", "[UNSUBSCRIBER]"), }; // Make the request Unsubscriber response = unsubscribersClient.GetUnsubscriber(request); // End snippet }
/// <summary>Snippet for GetUnsubscriberAsync</summary> public async Task GetUnsubscriberRequestObjectAsync() { // Snippet: GetUnsubscriberAsync(GetUnsubscriberRequest, CallSettings) // Additional: GetUnsubscriberAsync(GetUnsubscriberRequest, CancellationToken) // Create client UnsubscribersClient unsubscribersClient = await UnsubscribersClient.CreateAsync(); // Initialize request argument(s) GetUnsubscriberRequest request = new GetUnsubscriberRequest { UnsubscriberName = UnsubscriberName.FromProjectUnsubscriber("[PROJECT]", "[UNSUBSCRIBER]"), }; // Make the request Unsubscriber response = await unsubscribersClient.GetUnsubscriberAsync(request); // End snippet }