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