/// <summary>Snippet for UpdateApplication</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void UpdateApplicationRequestObject()
        {
            // Create client
            ApplicationsClient applicationsClient = ApplicationsClient.Create();
            // Initialize request argument(s)
            UpdateApplicationRequest request = new UpdateApplicationRequest
            {
                Name        = "",
                Application = new Application(),
                UpdateMask  = new FieldMask(),
            };
            // Make the request
            Operation <Application, OperationMetadataV1> response = applicationsClient.UpdateApplication(request);

            // Poll until the returned long-running operation is complete
            Operation <Application, OperationMetadataV1> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Application result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Application, OperationMetadataV1> retrievedResponse = applicationsClient.PollOnceUpdateApplication(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Application retrievedResult = retrievedResponse.Result;
            }
        }
        public void UpdateApplication()
        {
            moq::Mock <ApplicationService.ApplicationServiceClient> mockGrpcClient = new moq::Mock <ApplicationService.ApplicationServiceClient>(moq::MockBehavior.Strict);
            UpdateApplicationRequest request = new UpdateApplicationRequest
            {
                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.UpdateApplication(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ApplicationServiceClient client = new ApplicationServiceClientImpl(mockGrpcClient.Object, null);
            Application response            = client.UpdateApplication(request.Application);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async Task UpdateApplicationPartialReturnsValidResponse()
        {
            // Arrange
            var entity = _applicationFixture.ConstructTestEntity();

            await SetupTestData(entity).ConfigureAwait(false);

            var request = new UpdateApplicationRequest()
            {
                Status       = "Pending",
                OtherMembers = new List <Applicant>()
            };
            var json = JsonConvert.SerializeObject(request);

            // Act
            var response = await PatchTestRequestAsync(entity.Id, json).ConfigureAwait(false);

            response.StatusCode.Should().Be(HttpStatusCode.OK);

            var responseContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

            var apiEntity = JsonConvert.DeserializeObject <ApplicationResponse>(responseContent);

            // Assert
            apiEntity.Should().NotBeNull();
            apiEntity.Id.Should().NotBeEmpty();
            apiEntity.Status.Should().Be(request.Status);
            apiEntity.CreatedAt.Should().Be(entity.CreatedAt);
            apiEntity.MainApplicant.Should().BeEquivalentTo(entity.MainApplicant);
            apiEntity.OtherMembers.Should().BeEquivalentTo(request.OtherMembers);
        }
예제 #4
0
        internal virtual UpdateApplicationResponse UpdateApplication(UpdateApplicationRequest request)
        {
            var marshaller   = UpdateApplicationRequestMarshaller.Instance;
            var unmarshaller = UpdateApplicationResponseUnmarshaller.Instance;

            return(Invoke <UpdateApplicationRequest, UpdateApplicationResponse>(request, marshaller, unmarshaller));
        }
        /// <summary>
        /// <para>Updates the specified application to have the specified properties. </para> <para><b>NOTE:</b> If a property (for example,
        /// description) is not provided, the value remains unchanged. To clear these properties, specify an empty string. </para>
        /// </summary>
        ///
        /// <param name="updateApplicationRequest">Container for the necessary parameters to execute the UpdateApplication service method on
        ///           AmazonElasticBeanstalk.</param>
        ///
        /// <returns>The response from the UpdateApplication service method, as returned by AmazonElasticBeanstalk.</returns>
        ///
        public UpdateApplicationResponse UpdateApplication(UpdateApplicationRequest updateApplicationRequest)
        {
            IRequest <UpdateApplicationRequest> request  = new UpdateApplicationRequestMarshaller().Marshall(updateApplicationRequest);
            UpdateApplicationResponse           response = Invoke <UpdateApplicationRequest, UpdateApplicationResponse> (request, this.signer, UpdateApplicationResponseUnmarshaller.GetInstance());

            return(response);
        }
    public async Task update_azureAD_Application()
    {
        var appUri = string.Format("https://{0}/{1}", tenantId, "unittestmsiot");
        var repo   = new ServicePrincipalRepository(activeDirectoryClient, logger);
        var app    = await repo.CreateAppAndServicePrincipal("unittestmsiot",
                                                             appUri,
                                                             "msiot123",
                                                             tenantId);

        Assert.Equal("unittestmsiot", app.App.DisplayName);

        var updateModel = new UpdateApplicationRequest
        {
            Homepage  = "https://localhostunitest",
            ReplyUrls = new List <string>
            {
                "https://localhostunitest"
            }
        };
        await repo.UpdateAzureADApplication(app.App.ObjectId,
                                            updateModel,
                                            tenantId);

        app = await repo.CreateAppAndServicePrincipal("unittestmsiot",
                                                      appUri,
                                                      "msiot123",
                                                      tenantId);

        Assert.Equal(updateModel.Homepage, app.App.Homepage);
        Assert.True(app.App.ReplyUrls.Contains("https://localhostunitest"));
    }
        public Application UpdateApplication(Guid id, UpdateApplicationRequest request)
        {
            var entity = _dynamoDbContext.LoadAsync <ApplicationDbEntity>(id).GetAwaiter().GetResult();

            if (entity == null)
            {
                return(null);
            }

            if (!string.IsNullOrEmpty(request.Status))
            {
                entity.Status = request.Status;
            }

            if (request.MainApplicant != null)
            {
                entity.MainApplicant = request.MainApplicant;
            }

            if (request.OtherMembers != null)
            {
                entity.OtherMembers = request.OtherMembers.ToList();
            }

            _dynamoDbContext.SaveAsync(entity).GetAwaiter().GetResult();
            return(entity.ToDomain());
        }
        public async Task <IActionResult> PutApplication(int id, UpdateApplicationCommand command)
        {
            var request  = new UpdateApplicationRequest(id, command);
            var response = await _mediator.Send(command);

            return(Ok(response));
        }
예제 #9
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            UpdateApplicationRequest request;

            try
            {
                request = new UpdateApplicationRequest
                {
                    WorkspaceId              = WorkspaceId,
                    ApplicationKey           = ApplicationKey,
                    UpdateApplicationDetails = UpdateApplicationDetails,
                    IfMatch      = IfMatch,
                    OpcRequestId = OpcRequestId
                };

                response = client.UpdateApplication(request).GetAwaiter().GetResult();
                WriteOutput(response, response.Application);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
예제 #10
0
        /// <summary>
        /// Updates an application using an &#x60;applicationId&#x60;.
        ///
        /// </summary>
        /// <param name="request">The request object containing the details to send. Required.</param>
        /// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
        /// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
        /// <returns>A response object containing details about the completed operation</returns>
        public async Task <UpdateApplicationResponse> UpdateApplication(UpdateApplicationRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
        {
            logger.Trace("Called updateApplication");
            Uri                uri            = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/applications/{applicationId}".Trim('/')));
            HttpMethod         method         = new HttpMethod("Put");
            HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);

            requestMessage.Headers.Add("Accept", "application/json");
            GenericRetrier      retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
            HttpResponseMessage responseMessage;

            try
            {
                if (retryingClient != null)
                {
                    responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken);
                }
                else
                {
                    responseMessage = await this.restClient.HttpSend(requestMessage);
                }

                return(Converter.FromHttpResponseMessage <UpdateApplicationResponse>(responseMessage));
            }
            catch (Exception e)
            {
                logger.Error($"UpdateApplication failed with error: {e.Message}");
                throw;
            }
        }
        public async Task UpdateApplicationAsync2()
        {
            Mock <ApplicationService.ApplicationServiceClient> mockGrpcClient = new Mock <ApplicationService.ApplicationServiceClient>(MockBehavior.Strict);
            UpdateApplicationRequest request = new UpdateApplicationRequest
            {
                Application = new Application(),
            };
            Application expectedResponse = new Application
            {
                ApplicationName = new ApplicationName("[PROJECT]", "[TENANT]", "[PROFILE]", "[APPLICATION]"),
                ExternalId      = "externalId-1153075697",
                Profile         = "profile-309425751",
                Job             = "job105405",
                Company         = "company950484093",
                OutcomeNotes    = "outcomeNotes-355961964",
                JobTitleSnippet = "jobTitleSnippet-1100512972",
            };

            mockGrpcClient.Setup(x => x.UpdateApplicationAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Application>(Task.FromResult(expectedResponse), null, null, null, null));
            ApplicationServiceClient client = new ApplicationServiceClientImpl(mockGrpcClient.Object, null);
            Application response            = await client.UpdateApplicationAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
예제 #12
0
        /// <summary>
        /// Initiates the asynchronous execution of the UpdateApplication operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the UpdateApplication operation on AmazonServerlessApplicationRepositoryClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        ///
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUpdateApplication
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/serverlessrepo-2017-09-08/UpdateApplication">REST API Reference for UpdateApplication Operation</seealso>
        public virtual IAsyncResult BeginUpdateApplication(UpdateApplicationRequest request, AsyncCallback callback, object state)
        {
            var marshaller   = new UpdateApplicationRequestMarshaller();
            var unmarshaller = UpdateApplicationResponseUnmarshaller.Instance;

            return(BeginInvoke <UpdateApplicationRequest>(request, marshaller, unmarshaller,
                                                          callback, state));
        }
예제 #13
0
        public async Task <UpdateApplicationResponse> Update(UpdateApplicationRequest o)
        {
            var result = new UpdateApplicationResponse(o.RequestId);

            result.Updated = await Server.Update(o.Id, o.Name, o.Description);

            return(result);
        }
예제 #14
0
        /// <summary>
        /// Initiates the asynchronous execution of the UpdateApplication operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the UpdateApplication operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/discovery-2015-11-01/UpdateApplication">REST API Reference for UpdateApplication Operation</seealso>
        public virtual Task <UpdateApplicationResponse> UpdateApplicationAsync(UpdateApplicationRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = UpdateApplicationRequestMarshaller.Instance;
            var unmarshaller = UpdateApplicationResponseUnmarshaller.Instance;

            return(InvokeAsync <UpdateApplicationRequest, UpdateApplicationResponse>(request, marshaller,
                                                                                     unmarshaller, cancellationToken));
        }
예제 #15
0
        /// <summary>
        /// Initiates the asynchronous execution of the UpdateApplication operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the UpdateApplication operation on AmazonIoTFleetHubClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        ///
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUpdateApplication
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/iotfleethub-2020-11-03/UpdateApplication">REST API Reference for UpdateApplication Operation</seealso>
        public virtual IAsyncResult BeginUpdateApplication(UpdateApplicationRequest request, AsyncCallback callback, object state)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = UpdateApplicationRequestMarshaller.Instance;
            options.ResponseUnmarshaller = UpdateApplicationResponseUnmarshaller.Instance;

            return(BeginInvoke(request, options, callback, state));
        }
예제 #16
0
        /// <summary>
        /// Updates the specified application.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the UpdateApplication service method.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        ///
        /// <returns>The response from the UpdateApplication service method, as returned by ServerlessApplicationRepository.</returns>
        /// <exception cref="Amazon.ServerlessApplicationRepository.Model.BadRequestException">
        /// One of the parameters in the request is invalid.
        /// </exception>
        /// <exception cref="Amazon.ServerlessApplicationRepository.Model.ConflictException">
        /// The resource already exists.
        /// </exception>
        /// <exception cref="Amazon.ServerlessApplicationRepository.Model.ForbiddenException">
        /// The client is not authenticated.
        /// </exception>
        /// <exception cref="Amazon.ServerlessApplicationRepository.Model.InternalServerErrorException">
        /// The AWS Serverless Application Repository service encountered an internal error.
        /// </exception>
        /// <exception cref="Amazon.ServerlessApplicationRepository.Model.NotFoundException">
        /// The resource (for example, an access policy statement) specified in the request doesn't
        /// exist.
        /// </exception>
        /// <exception cref="Amazon.ServerlessApplicationRepository.Model.TooManyRequestsException">
        /// The client is sending more than the allowed number of requests per unit of time.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/serverlessrepo-2017-09-08/UpdateApplication">REST API Reference for UpdateApplication Operation</seealso>
        public virtual Task <UpdateApplicationResponse> UpdateApplicationAsync(UpdateApplicationRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = UpdateApplicationRequestMarshaller.Instance;
            options.ResponseUnmarshaller = UpdateApplicationResponseUnmarshaller.Instance;

            return(InvokeAsync <UpdateApplicationResponse>(request, options, cancellationToken));
        }
예제 #17
0
        internal virtual UpdateApplicationResponse UpdateApplication(UpdateApplicationRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = UpdateApplicationRequestMarshaller.Instance;
            options.ResponseUnmarshaller = UpdateApplicationResponseUnmarshaller.Instance;

            return(Invoke <UpdateApplicationResponse>(request, options));
        }
예제 #18
0
        public IActionResult UpdateApplication([FromRoute][Required] Guid id, [FromBody] UpdateApplicationRequest applicationRequest)
        {
            var result = _updateApplicationUseCase.Execute(id, applicationRequest);

            if (result == null)
            {
                return(NotFound(id));
            }

            return(Ok(result));
        }
예제 #19
0
        /// <summary>
        /// 修改应用程序
        /// </summary>
        /// <param name="request">request</param>
        public async Task UpdateAsync(UpdateApplicationRequest request)
        {
            var entity = await ApplicationRepository.FindAsync(request.Id.ToGuid());

            request.MapTo(entity);
            await ValidateUpdateAsync(entity);

            await ApplicationRepository.UpdateAsync(entity);

            await UnitOfWork.CommitAsync();
        }
예제 #20
0
 /// <summary>Snippet for UpdateApplication</summary>
 public void UpdateApplication_RequestObject()
 {
     // Snippet: UpdateApplication(UpdateApplicationRequest,CallSettings)
     // Create client
     ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.Create();
     // Initialize request argument(s)
     UpdateApplicationRequest request = new UpdateApplicationRequest
     {
         Application = new Application(),
     };
     // Make the request
     Application response = applicationServiceClient.UpdateApplication(request);
     // End snippet
 }
        public async Task ThenTheApplicationIsUpdatedWithNewSelectionOfApprenticeships()
        {
            SetupExpectedUpdateIncentiveApplication();

            var request = new UpdateApplicationRequest
            {
                ApplicationId     = _applicationId,
                AccountId         = _accountId,
                ApprenticeshipIds = _apprenticeshipIds
            };

            _response = await _context.OuterApiClient.PutAsync($"accounts/{_accountId}/applications", new StringContent(JsonSerializer.Serialize(request), Encoding.UTF8, "application/json"));

            _response.EnsureSuccessStatusCode();
        }
예제 #22
0
        public void CRUDApplication()
        {
            string applicationName = "dotnet-integ-app" + DateTime.Now.Ticks;
            CreateApplicationRequest createRequest = new CreateApplicationRequest()
            {
                ApplicationName = applicationName,
                Description     = "Test Application"
            };

            CreateApplicationResponse createResponse = Client.CreateApplication(createRequest);

            Assert.IsNotNull(createResponse.ResponseMetadata.RequestId);

            try
            {
                DescribeApplicationsResponse describeResponse = Client.DescribeApplications(new DescribeApplicationsRequest()
                {
                    ApplicationNames = new List <string>()
                    {
                        applicationName
                    }
                });
                Assert.AreEqual(1, describeResponse.Applications.Count);
                ApplicationDescription app = describeResponse.Applications[0];
                Assert.AreEqual(applicationName, app.ApplicationName);
                Assert.AreEqual("Test Application", app.Description);
                Assert.AreNotEqual(DateTime.MinValue, app.DateCreated);
                Assert.AreNotEqual(DateTime.MinValue, app.DateUpdated);

                UpdateApplicationRequest updateRequest = new UpdateApplicationRequest()
                {
                    ApplicationName = applicationName,
                    Description     = "updated description"
                };
                UpdateApplicationResponse updateResponse = Client.UpdateApplication(updateRequest);
                Assert.AreEqual(applicationName, updateResponse.Application.ApplicationName);
                Assert.AreEqual("updated description", updateResponse.Application.Description);
            }
            finally
            {
                Client.DeleteApplication(new DeleteApplicationRequest()
                {
                    ApplicationName = applicationName
                });
            }
        }
예제 #23
0
        public async Task <IActionResult> Put([FromBody] UpdateApplicationRequest request)
        {
            IActionResult result = null;

            var updated = await Server.Update(request.Id, request.Name, request.Description);

            if (updated)
            {
                result = Factory.CreateSuccessResponse(updated);
            }
            else
            {
                result = Factory.CreateNoContentResponse();
            }

            return(result);
        }
예제 #24
0
        /// <summary>Snippet for UpdateApplicationAsync</summary>
        public async Task UpdateApplicationAsync_RequestObject()
        {
            // Snippet: UpdateApplicationAsync(UpdateApplicationRequest,CallSettings)
            // Additional: UpdateApplicationAsync(UpdateApplicationRequest,CancellationToken)
            // Create client
            ApplicationServiceClient applicationServiceClient = await ApplicationServiceClient.CreateAsync();

            // Initialize request argument(s)
            UpdateApplicationRequest request = new UpdateApplicationRequest
            {
                Application = new Application(),
            };
            // Make the request
            Application response = await applicationServiceClient.UpdateApplicationAsync(request);

            // End snippet
        }
예제 #25
0
        public async Task UpdateAzureADApplication([FromBody] UpdateApplicationModel updateApp)
        {
            try
            {
                logger.LogInformation("Update Azure AD Application: {application}", updateApp.HomePage);
                var updateModel = new UpdateApplicationRequest()
                {
                    Homepage  = updateApp.HomePage,
                    ReplyUrls = updateApp.ReplyUrls
                };
                await _servicePrincipalRepo.UpdateAzureADApplication(updateApp.AppObjectId, updateModel, tokenServices.TenantId);

                logger.LogInformation("Update Azure AD Application Reply url updated: {application}", updateApp.HomePage);
            }
            catch (Exception e)
            {
                logger.LogError(e, "Update Azure AD Application: - Exception {message}", e.Message);
            }
        }
예제 #26
0
        public async Task UpdateAzureADApplication(string appObjectId, UpdateApplicationRequest updateReq, string tenantId)
        {
            try
            {
                var adApp = await adClient.Applications.GetByObjectId(appObjectId).ExecuteAsync();

                adApp.ReplyUrls.Clear();
                updateReq.ReplyUrls.ForEach(adApp.ReplyUrls.Add);

                adApp.Homepage = updateReq.Homepage;

                await adApp.UpdateAsync();
            }
            catch (Exception ex)
            {
                logger.LogError(ex, "Update Azure AD Application {error}", ex.Message);
                throw;
            }
        }
        public async Task Then_UpdateApplicationCommand_Is_Sent(
            UpdateApplicationRequest request,
            [Frozen] Mock <IMediator> mockMediator,
            [Greedy] ApplicationController controller)
        {
            var applicationId = request.ApplicationId;

            mockMediator
            .Setup(mediator => mediator.Send <Unit>(
                       It.Is <UpdateApplicationCommand>(c =>
                                                        c.AccountId == request.AccountId &&
                                                        c.ApplicationId == request.ApplicationId &&
                                                        c.ApprenticeshipIds == request.ApprenticeshipIds
                                                        ), It.IsAny <CancellationToken>())).ReturnsAsync(Unit.Value);

            var controllerResult = await controller.UpdateApplication(request) as OkObjectResult;

            Assert.IsNotNull(controllerResult);
            controllerResult.StatusCode.Should().Be((int)HttpStatusCode.OK);
            controllerResult.Value.Should().Be($"/accounts/{request.AccountId}/applications/{applicationId}");
        }
예제 #28
0
        public async stt::Task UpdateApplicationRequestObjectAsync()
        {
            moq::Mock <ApplicationService.ApplicationServiceClient> mockGrpcClient = new moq::Mock <ApplicationService.ApplicationServiceClient>(moq::MockBehavior.Strict);
            UpdateApplicationRequest request = new UpdateApplicationRequest
            {
                Application = new Application(),
                UpdateMask  = new wkt::FieldMask(),
            };
            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.UpdateApplicationAsync(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.UpdateApplicationAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public async Task UpdateAzureADApplication(string appObjectId, UpdateApplicationRequest updateReq,
                                                   string tenantId, string token)
        {
            try
            {
                var client   = new RestClient(_graphUrl);
                var endPoint = String.Format("/{0}/applications/{1}", tenantId, appObjectId);
                var request  = new RestRequest(endPoint, Method.PATCH);
                request.AddQueryParameter("api-version", "1.6");

                request.AddHeader("Authorization", "Bearer " + token);
                request.AddHeader("Content-Type", "application/json");

                var body = JsonConvert.SerializeObject(updateReq);
                request.AddParameter("application/json", body, ParameterType.RequestBody);

                await client.ExecuteTaskAsync(request);
            }
            catch (Exception ex)
            {
                Log.Error("Update Azure AD Application {@error}", ex.Message);
                throw ex;
            }
        }
        /// <summary>Snippet for UpdateApplicationAsync</summary>
        public async Task UpdateApplicationRequestObjectAsync()
        {
            // Snippet: UpdateApplicationAsync(UpdateApplicationRequest, CallSettings)
            // Additional: UpdateApplicationAsync(UpdateApplicationRequest, CancellationToken)
            // Create client
            ApplicationsClient applicationsClient = await ApplicationsClient.CreateAsync();

            // Initialize request argument(s)
            UpdateApplicationRequest request = new UpdateApplicationRequest
            {
                Name        = "",
                Application = new Application(),
                UpdateMask  = new FieldMask(),
            };
            // Make the request
            Operation <Application, OperationMetadataV1> response = await applicationsClient.UpdateApplicationAsync(request);

            // Poll until the returned long-running operation is complete
            Operation <Application, OperationMetadataV1> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            Application result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Application, OperationMetadataV1> retrievedResponse = await applicationsClient.PollOnceUpdateApplicationAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Application retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }