public void List() { moq::Mock <TargetGrpcProxies.TargetGrpcProxiesClient> mockGrpcClient = new moq::Mock <TargetGrpcProxies.TargetGrpcProxiesClient>(moq::MockBehavior.Strict); ListTargetGrpcProxiesRequest request = new ListTargetGrpcProxiesRequest { Project = "projectaa6ff846", }; TargetGrpcProxyList expectedResponse = new TargetGrpcProxyList { Id = "id74b70bb8", Kind = "kindf7aa39d9", Warning = new Warning(), NextPageToken = "next_page_tokendbee0940", Items = { new TargetGrpcProxy(), }, SelfLink = "self_link7e87f12d", }; mockGrpcClient.Setup(x => x.List(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); TargetGrpcProxiesClient client = new TargetGrpcProxiesClientImpl(mockGrpcClient.Object, null); TargetGrpcProxyList response = client.List(request.Project); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task ListAsync() { moq::Mock <TargetGrpcProxies.TargetGrpcProxiesClient> mockGrpcClient = new moq::Mock <TargetGrpcProxies.TargetGrpcProxiesClient>(moq::MockBehavior.Strict); ListTargetGrpcProxiesRequest request = new ListTargetGrpcProxiesRequest { Project = "projectaa6ff846", }; TargetGrpcProxyList expectedResponse = new TargetGrpcProxyList { Id = "id74b70bb8", Kind = "kindf7aa39d9", Warning = new Warning(), NextPageToken = "next_page_tokendbee0940", Items = { new TargetGrpcProxy(), }, SelfLink = "self_link7e87f12d", }; mockGrpcClient.Setup(x => x.ListAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <TargetGrpcProxyList>(stt::Task.FromResult(expectedResponse), null, null, null, null)); TargetGrpcProxiesClient client = new TargetGrpcProxiesClientImpl(mockGrpcClient.Object, null); TargetGrpcProxyList responseCallSettings = await client.ListAsync(request.Project, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); TargetGrpcProxyList responseCancellationToken = await client.ListAsync(request.Project, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void ListRequestObject() { moq::Mock <TargetGrpcProxies.TargetGrpcProxiesClient> mockGrpcClient = new moq::Mock <TargetGrpcProxies.TargetGrpcProxiesClient>(moq::MockBehavior.Strict); ListTargetGrpcProxiesRequest request = new ListTargetGrpcProxiesRequest { PageToken = "page_tokenf09e5538", MaxResults = 2806814450U, OrderBy = "order_byb4d33ada", Project = "projectaa6ff846", Filter = "filtere47ac9b2", ReturnPartialSuccess = false, }; TargetGrpcProxyList expectedResponse = new TargetGrpcProxyList { Id = "id74b70bb8", Kind = "kindf7aa39d9", Warning = new Warning(), NextPageToken = "next_page_tokendbee0940", Items = { new TargetGrpcProxy(), }, SelfLink = "self_link7e87f12d", }; mockGrpcClient.Setup(x => x.List(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); TargetGrpcProxiesClient client = new TargetGrpcProxiesClientImpl(mockGrpcClient.Object, null); TargetGrpcProxyList response = client.List(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for List</summary> public void List() { // Snippet: List(string, CallSettings) // Create client TargetGrpcProxiesClient targetGrpcProxiesClient = TargetGrpcProxiesClient.Create(); // Initialize request argument(s) string project = ""; // Make the request TargetGrpcProxyList response = targetGrpcProxiesClient.List(project); // End snippet }
/// <summary>Snippet for ListAsync</summary> public async Task ListAsync() { // Snippet: ListAsync(string, CallSettings) // Additional: ListAsync(string, CancellationToken) // Create client TargetGrpcProxiesClient targetGrpcProxiesClient = await TargetGrpcProxiesClient.CreateAsync(); // Initialize request argument(s) string project = ""; // Make the request TargetGrpcProxyList response = await targetGrpcProxiesClient.ListAsync(project); // End snippet }
/// <summary>Snippet for List</summary> public void ListRequestObject() { // Snippet: List(ListTargetGrpcProxiesRequest, CallSettings) // Create client TargetGrpcProxiesClient targetGrpcProxiesClient = TargetGrpcProxiesClient.Create(); // Initialize request argument(s) ListTargetGrpcProxiesRequest request = new ListTargetGrpcProxiesRequest { PageToken = "", MaxResults = 0U, Filter = "", OrderBy = "", Project = "", ReturnPartialSuccess = false, }; // Make the request TargetGrpcProxyList response = targetGrpcProxiesClient.List(request); // End snippet }
/// <summary>Snippet for ListAsync</summary> public async Task ListRequestObjectAsync() { // Snippet: ListAsync(ListTargetGrpcProxiesRequest, CallSettings) // Additional: ListAsync(ListTargetGrpcProxiesRequest, CancellationToken) // Create client TargetGrpcProxiesClient targetGrpcProxiesClient = await TargetGrpcProxiesClient.CreateAsync(); // Initialize request argument(s) ListTargetGrpcProxiesRequest request = new ListTargetGrpcProxiesRequest { PageToken = "", MaxResults = 0U, Filter = "", OrderBy = "", Project = "", ReturnPartialSuccess = false, }; // Make the request TargetGrpcProxyList response = await targetGrpcProxiesClient.ListAsync(request); // End snippet }