public async stt::Task ListAsync() { moq::Mock <GlobalOrganizationOperations.GlobalOrganizationOperationsClient> mockGrpcClient = new moq::Mock <GlobalOrganizationOperations.GlobalOrganizationOperationsClient>(moq::MockBehavior.Strict); ListGlobalOrganizationOperationsRequest request = new ListGlobalOrganizationOperationsRequest { }; OperationList expectedResponse = new OperationList { Id = "id74b70bb8", Kind = "kindf7aa39d9", Warning = new Warning(), NextPageToken = "next_page_tokendbee0940", Items = { new Operation(), }, SelfLink = "self_link7e87f12d", }; mockGrpcClient.Setup(x => x.ListAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <OperationList>(stt::Task.FromResult(expectedResponse), null, null, null, null)); GlobalOrganizationOperationsClient client = new GlobalOrganizationOperationsClientImpl(mockGrpcClient.Object, null); OperationList responseCallSettings = await client.ListAsync(gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); OperationList responseCancellationToken = await client.ListAsync(st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async stt::Task ListRequestObjectAsync() { moq::Mock <GlobalOrganizationOperations.GlobalOrganizationOperationsClient> mockGrpcClient = new moq::Mock <GlobalOrganizationOperations.GlobalOrganizationOperationsClient>(moq::MockBehavior.Strict); ListGlobalOrganizationOperationsRequest request = new ListGlobalOrganizationOperationsRequest { PageToken = "page_tokenf09e5538", MaxResults = 2806814450U, Filter = "filtere47ac9b2", OrderBy = "order_byb4d33ada", ParentId = "parent_id8279e36b", ReturnPartialSuccess = false, }; OperationList expectedResponse = new OperationList { Id = "id74b70bb8", Kind = "kindf7aa39d9", Warning = new Warning(), NextPageToken = "next_page_tokendbee0940", Items = { new Operation(), }, SelfLink = "self_link7e87f12d", }; mockGrpcClient.Setup(x => x.ListAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <OperationList>(stt::Task.FromResult(expectedResponse), null, null, null, null)); GlobalOrganizationOperationsClient client = new GlobalOrganizationOperationsClientImpl(mockGrpcClient.Object, null); OperationList responseCallSettings = await client.ListAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); OperationList responseCancellationToken = await client.ListAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }