public void CreateApplicationRequestObject()
        {
            moq::Mock <ApplicationService.ApplicationServiceClient> mockGrpcClient = new moq::Mock <ApplicationService.ApplicationServiceClient>(moq::MockBehavior.Strict);
            CreateApplicationRequest request = new CreateApplicationRequest
            {
                ParentAsProfileName = ProfileName.FromProjectTenantProfile("[PROJECT]", "[TENANT]", "[PROFILE]"),
                Application         = new Application(),
            };
            Application expectedResponse = new Application
            {
                ApplicationName      = ApplicationName.FromProjectTenantProfileApplication("[PROJECT]", "[TENANT]", "[PROFILE]", "[APPLICATION]"),
                Profile              = "profile1b48977d",
                JobAsJobName         = JobName.FromProjectTenantJob("[PROJECT]", "[TENANT]", "[JOB]"),
                CompanyAsCompanyName = CompanyName.FromProjectTenantCompany("[PROJECT]", "[TENANT]", "[COMPANY]"),
                ApplicationDate      = new gt::Date(),
                Stage           = Application.Types.ApplicationStage.OfferAccepted,
                State           = Application.Types.ApplicationState.Unspecified,
                Interviews      = { new Interview(), },
                Referral        = false,
                CreateTime      = new wkt::Timestamp(),
                UpdateTime      = new wkt::Timestamp(),
                OutcomeNotes    = "outcome_notes38ed921d",
                Outcome         = Outcome.Neutral,
                IsMatch         = false,
                JobTitleSnippet = "job_title_snippet4f14afe7",
                ExternalId      = "external_id9442680e",
            };

            mockGrpcClient.Setup(x => x.CreateApplication(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ApplicationServiceClient client = new ApplicationServiceClientImpl(mockGrpcClient.Object, null);
            Application response            = client.CreateApplication(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>Snippet for GetProfile</summary>
 public void GetProfileResourceNames()
 {
     // Snippet: GetProfile(ProfileName, CallSettings)
     // Create client
     ProfileServiceClient profileServiceClient = ProfileServiceClient.Create();
     // Initialize request argument(s)
     ProfileName name = ProfileName.FromProjectTenantProfile("[PROJECT]", "[TENANT]", "[PROFILE]");
     // Make the request
     Profile response = profileServiceClient.GetProfile(name);
     // End snippet
 }
 /// <summary>Snippet for CreateApplication</summary>
 public void CreateApplicationResourceNames()
 {
     // Snippet: CreateApplication(ProfileName, Application, CallSettings)
     // Create client
     ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.Create();
     // Initialize request argument(s)
     ProfileName parent      = ProfileName.FromProjectTenantProfile("[PROJECT]", "[TENANT]", "[PROFILE]");
     Application application = new Application();
     // Make the request
     Application response = applicationServiceClient.CreateApplication(parent, application);
     // End snippet
 }
        /// <summary>Snippet for DeleteProfileAsync</summary>
        public async Task DeleteProfileResourceNamesAsync()
        {
            // Snippet: DeleteProfileAsync(ProfileName, CallSettings)
            // Additional: DeleteProfileAsync(ProfileName, CancellationToken)
            // Create client
            ProfileServiceClient profileServiceClient = await ProfileServiceClient.CreateAsync();

            // Initialize request argument(s)
            ProfileName name = ProfileName.FromProjectTenantProfile("[PROJECT]", "[TENANT]", "[PROFILE]");
            // Make the request
            await profileServiceClient.DeleteProfileAsync(name);

            // End snippet
        }
 /// <summary>Snippet for GetProfile</summary>
 public void GetProfileRequestObject()
 {
     // Snippet: GetProfile(GetProfileRequest, CallSettings)
     // Create client
     ProfileServiceClient profileServiceClient = ProfileServiceClient.Create();
     // Initialize request argument(s)
     GetProfileRequest request = new GetProfileRequest
     {
         ProfileName = ProfileName.FromProjectTenantProfile("[PROJECT]", "[TENANT]", "[PROFILE]"),
     };
     // Make the request
     Profile response = profileServiceClient.GetProfile(request);
     // End snippet
 }
 /// <summary>Snippet for CreateApplication</summary>
 public void CreateApplicationRequestObject()
 {
     // Snippet: CreateApplication(CreateApplicationRequest, CallSettings)
     // Create client
     ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.Create();
     // Initialize request argument(s)
     CreateApplicationRequest request = new CreateApplicationRequest
     {
         ParentAsProfileName = ProfileName.FromProjectTenantProfile("[PROJECT]", "[TENANT]", "[PROFILE]"),
         Application         = new Application(),
     };
     // Make the request
     Application response = applicationServiceClient.CreateApplication(request);
     // End snippet
 }
        /// <summary>Snippet for CreateApplicationAsync</summary>
        public async Task CreateApplicationResourceNamesAsync()
        {
            // Snippet: CreateApplicationAsync(ProfileName, Application, CallSettings)
            // Additional: CreateApplicationAsync(ProfileName, Application, CancellationToken)
            // Create client
            ApplicationServiceClient applicationServiceClient = await ApplicationServiceClient.CreateAsync();

            // Initialize request argument(s)
            ProfileName parent      = ProfileName.FromProjectTenantProfile("[PROJECT]", "[TENANT]", "[PROFILE]");
            Application application = new Application();
            // Make the request
            Application response = await applicationServiceClient.CreateApplicationAsync(parent, application);

            // End snippet
        }
        /// <summary>Snippet for ListApplicationsAsync</summary>
        public async Task ListApplicationsRequestObjectAsync()
        {
            // Snippet: ListApplicationsAsync(ListApplicationsRequest, CallSettings)
            // Create client
            ApplicationServiceClient applicationServiceClient = await ApplicationServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListApplicationsRequest request = new ListApplicationsRequest
            {
                ParentAsProfileName = ProfileName.FromProjectTenantProfile("[PROJECT]", "[TENANT]", "[PROFILE]"),
            };
            // Make the request
            PagedAsyncEnumerable <ListApplicationsResponse, Application> response = applicationServiceClient.ListApplicationsAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Application item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((ListApplicationsResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Application item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <Application> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Application item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
        /// <summary>Snippet for GetProfileAsync</summary>
        public async Task GetProfileRequestObjectAsync()
        {
            // Snippet: GetProfileAsync(GetProfileRequest, CallSettings)
            // Additional: GetProfileAsync(GetProfileRequest, CancellationToken)
            // Create client
            ProfileServiceClient profileServiceClient = await ProfileServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetProfileRequest request = new GetProfileRequest
            {
                ProfileName = ProfileName.FromProjectTenantProfile("[PROJECT]", "[TENANT]", "[PROFILE]"),
            };
            // Make the request
            Profile response = await profileServiceClient.GetProfileAsync(request);

            // End snippet
        }
        /// <summary>Snippet for CreateApplicationAsync</summary>
        public async Task CreateApplicationRequestObjectAsync()
        {
            // Snippet: CreateApplicationAsync(CreateApplicationRequest, CallSettings)
            // Additional: CreateApplicationAsync(CreateApplicationRequest, CancellationToken)
            // Create client
            ApplicationServiceClient applicationServiceClient = await ApplicationServiceClient.CreateAsync();

            // Initialize request argument(s)
            CreateApplicationRequest request = new CreateApplicationRequest
            {
                ParentAsProfileName = ProfileName.FromProjectTenantProfile("[PROJECT]", "[TENANT]", "[PROFILE]"),
                Application         = new Application(),
            };
            // Make the request
            Application response = await applicationServiceClient.CreateApplicationAsync(request);

            // End snippet
        }
        /// <summary>Snippet for ListApplications</summary>
        public void ListApplicationsResourceNames()
        {
            // Snippet: ListApplications(ProfileName, string, int?, CallSettings)
            // Create client
            ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.Create();
            // Initialize request argument(s)
            ProfileName parent = ProfileName.FromProjectTenantProfile("[PROJECT]", "[TENANT]", "[PROFILE]");
            // Make the request
            PagedEnumerable <ListApplicationsResponse, Application> response = applicationServiceClient.ListApplications(parent);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (Application item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over pages (of server-defined size), performing one RPC per page
            foreach (ListApplicationsResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Application item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            }

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <Application> singlePage = response.ReadPage(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Application item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Exemplo n.º 12
0
        public async stt::Task CreateApplicationResourceNamesAsync()
        {
            moq::Mock <ApplicationService.ApplicationServiceClient> mockGrpcClient = new moq::Mock <ApplicationService.ApplicationServiceClient>(moq::MockBehavior.Strict);
            CreateApplicationRequest request = new CreateApplicationRequest
            {
                ParentAsProfileName = ProfileName.FromProjectTenantProfile("[PROJECT]", "[TENANT]", "[PROFILE]"),
                Application         = new Application(),
            };
            Application expectedResponse = new Application
            {
                ApplicationName      = ApplicationName.FromProjectTenantProfileApplication("[PROJECT]", "[TENANT]", "[PROFILE]", "[APPLICATION]"),
                Profile              = "profile1b48977d",
                JobAsJobName         = JobName.FromProjectJob("[PROJECT]", "[JOB]"),
                CompanyAsCompanyName = CompanyName.FromProjectCompany("[PROJECT]", "[COMPANY]"),
                ApplicationDate      = new gt::Date(),
                Stage           = Application.Types.ApplicationStage.OfferAccepted,
                State           = Application.Types.ApplicationState.Unspecified,
                Interviews      = { new Interview(), },
                Referral        = new bool?(),
                CreateTime      = new wkt::Timestamp(),
                UpdateTime      = new wkt::Timestamp(),
                OutcomeNotes    = "outcome_notes38ed921d",
                Outcome         = Outcome.Neutral,
                IsMatch         = new bool?(),
                JobTitleSnippet = "job_title_snippet4f14afe7",
                ExternalId      = "external_id9442680e",
            };

            mockGrpcClient.Setup(x => x.CreateApplicationAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Application>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            ApplicationServiceClient client  = new ApplicationServiceClientImpl(mockGrpcClient.Object, null);
            Application responseCallSettings = await client.CreateApplicationAsync(request.ParentAsProfileName, request.Application, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Application responseCancellationToken = await client.CreateApplicationAsync(request.ParentAsProfileName, request.Application, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }