public void ConsultandoUmProjeto() { #region Inserindo um novo projeto string projectName = "ConsultandoUmProjeto"; var consultaProjetoDB = projectsDBSteps.InseriProjetoDB(projectName); #endregion #region Parameters //Resultado Esperado string statusCodeExpected = "OK"; #endregion GetProjectRequest getProjectRequest = new GetProjectRequest(consultaProjetoDB.ProjectId); IRestResponse <dynamic> response = getProjectRequest.ExecuteRequest(); Assert.Multiple(() => { Assert.AreEqual(statusCodeExpected, response.StatusCode.ToString(), "O status code retornado não é o esperado."); Assert.AreEqual(consultaProjetoDB.ProjectName, response.Data["projects"][0]["name"].ToString(), "O nome do projeto está diferente."); Assert.AreEqual(consultaProjetoDB.ProjectStatusId, Convert.ToInt32(response.Data["projects"][0]["status"]["id"]), "O id do projeto está diferente."); Assert.AreEqual(consultaProjetoDB.Enabled, Convert.ToInt32(response.Data["projects"][0]["enabled"]), "O status da ativação está diferente."); Assert.AreEqual(consultaProjetoDB.ViewState, Convert.ToInt32(response.Data["projects"][0]["view_state"]["id"]), "O view state está diferente."); Assert.AreEqual(consultaProjetoDB.Description, response.Data["projects"][0]["description"].ToString(), "A descrição está diferente."); }); projectsDBSteps.DeletaProjetoDB(consultaProjetoDB.ProjectId); }
public Task <IResponse <GetProjectResult> > GetProjectAsync(GetProjectRequest request) { return(SendRequestAsync( new HttpRequestMessageBuilder(HttpMethod.Get, "/"), resolver => resolver .With <ProjectDetailInfo>() .ResolveAsync(x => new GetProjectResult(x)), project: request.ProjectName)); }
public void Load() { GetProjectRequest request = new GetProjectRequest(Id); Deserialization.Project project = Connection.Get <Deserialization.Project>(request); project.MapTo(this); IsLoaded = true; }
public async Task <IActionResult> GetAsync(GetProjectRequest request) { var project = await _projectService.GetProjectAsync(request.ProjectId); if (project == null) { return(NotFound()); } return(Ok(project)); }
public GetProjectResponse GetProject(GetProjectRequest request, UnitOfWork context) { var response = new GetProjectResponse(); var project = context.Projects.GetItem(request.Id); project.Tasks = project.Tasks?.Select(t => context.Tasks.GetItem(t.Id)); response.Project = project; return(response); }
/// <summary> /// Creates a waiter using the provided configuration. /// </summary> /// <param name="request">Request to send.</param> /// <param name="config">Wait Configuration</param> /// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param> /// <returns>a new Oci.common.Waiter instance</returns> public Waiter <GetProjectRequest, GetProjectResponse> ForProject(GetProjectRequest request, WaiterConfiguration config, params ProjectLifecycleState[] targetStates) { var agent = new WaiterAgent <GetProjectRequest, GetProjectResponse>( request, request => client.GetProject(request), response => targetStates.Contains(response.Project.LifecycleState.Value), targetStates.Contains(ProjectLifecycleState.Deleted) ); return(new Waiter <GetProjectRequest, GetProjectResponse>(config, agent)); }
public GetProjectResponse GetProject(GetProjectRequest request) { if (request == null) { return new GetProjectResponse { Success = false, Message = "Error: null request" } } ; var projects = _service.GetAll().ToList(); if (projects == null) { return new GetProjectResponse { Success = false, Message = "Error: There are no projects" } } ; //var projectsDTO = new List<ProjectDTO>(); //foreach (var item in projects) //{ // projectsDTO.Add(new ProjectDTO // { // Id = item.Id, // Name = item.Name, // Area = item.Area, // TechnologyStack = item.TechnologyStack // }); //} ICollection <ProjectDTO> projectList = projects.Select(p => new ProjectDTO { Id = p.Id, Name = p.Name, Area = p.Area, TechnologyStack = p.TechnologyStack }).ToList(); return(new GetProjectResponse { Success = true, Projects = projectList }); } } }
public async Task <ProjectDto> GetProject(string projectIdentifier, string organization = default, CancellationToken cancellationToken = default) { var request = new GetProjectRequest(organization ?? _options.Value.DefaultOrganization, projectIdentifier); request.Headers.Authorization = GetAuthZHeader(); var response = await SendAsync(request, cancellationToken); var projectDto = await response.Content.ReadFromJsonAsync <ProjectDto>(null, cancellationToken); return(projectDto); }
/// <summary>Snippet for Get</summary> public void GetRequestObject() { // Snippet: Get(GetProjectRequest, CallSettings) // Create client ProjectsClient projectsClient = ProjectsClient.Create(); // Initialize request argument(s) GetProjectRequest request = new GetProjectRequest { Project = "", }; // Make the request Project response = projectsClient.Get(request); // End snippet }
public void CanBeConstructed() { //Arrange GetProjectRequest sut; //Act sut = new GetProjectRequest("my-org", "CloudEngineering"); //Assert Assert.NotNull(sut); Assert.Equal("6.0", sut.ApiVersion); Assert.Equal(HttpMethod.Get, sut.Method); Assert.Equal("https://dev.azure.com/my-org/_apis/projects/CloudEngineering?api-version=6.0", sut.RequestUri.AbsoluteUri); }
/// <summary>Snippet for GetAsync</summary> public async Task GetRequestObjectAsync() { // Snippet: GetAsync(GetProjectRequest, CallSettings) // Additional: GetAsync(GetProjectRequest, CancellationToken) // Create client ProjectsClient projectsClient = await ProjectsClient.CreateAsync(); // Initialize request argument(s) GetProjectRequest request = new GetProjectRequest { Project = "", }; // Make the request Project response = await projectsClient.GetAsync(request); // End snippet }
public void RetornaProjetoCriadoIdInexistente() { #region Parameters int projectId = 99999; //Resultado Esperado string statusCodeExpected = "NotFound"; string statusDescriptionExpected = "Project #" + projectId + " not found"; #endregion GetProjectRequest getProjectRequest = new GetProjectRequest(projectId); IRestResponse <dynamic> response = getProjectRequest.ExecuteRequest(); Assert.Multiple(() => { Assert.AreEqual(statusCodeExpected, response.StatusCode.ToString(), "O status code retornado não é o esperado."); Assert.AreEqual(statusDescriptionExpected, response.StatusDescription, "O status description retornado não é o esperado."); }); }
public override async Task <GetProjectResponse> GetProject(GetProjectRequest request, ServerCallContext context) { var resp = new GetProjectResponse(); if (_projectManager.Project == null) { resp.HasProject = false; resp.Project = null; return(resp); } resp.HasProject = true; resp.Project = new Grpc.Editor.Project(); resp.Project.HashCode = _projectManager.Project.GetHashCode(); resp.Project.ProjectPath = _projectManager.Project.ProjectPath.FullName; resp.Project.LoadingStatus = _projectManager.Project.LoadingStatus ?? ""; resp.Project.Name = _projectManager.Project.Name; resp.Project.DefaultGameDefinitionName = _projectManager.Project.DefaultGame.Name; resp.Project.SolutionFilePath = _projectManager.Project.SolutionFile.FullName; resp.Project.DefaultGameBinPath = _projectManager.Project.DefaultGameBinPath.FullName; foreach (var package in _projectManager.Project.Packages) { resp.Project.Packages.Add(new Package { Package_ = package.Package, Repository = package.Repository, Version = package.Version }); } foreach (var definition in _projectManager.Project.Definitions) { resp.Project.Definitions.Add(new Definition { Name = definition.Name, Type = definition.Type, Role = definition.Role, XmlDocumentPath = definition.LoadedDocumentPath }); } return(resp); }
public void GetAll() { System.Console.WriteLine("Get all the projects..."); GetProjectRequest request = new GetProjectRequest { }; GetProjectResponse response = _projectClient.GetProject(request); var projectlist = response.Projects; foreach (var p in projectlist) { System.Console.WriteLine($"Id {p.Id}\n" + $"Area {p.Area}\n" + $"Name {p.Name}\n" + $"Technology Stack {p.TechnologyStack}"); System.Console.WriteLine("-------------"); } System.Console.WriteLine("-------------"); System.Console.WriteLine("-------------"); }
private void HandleOutput(GetProjectRequest request) { var waiterConfig = new WaiterConfiguration { MaxAttempts = MaxWaitAttempts, GetNextDelayInSeconds = (_) => WaitIntervalSeconds }; switch (ParameterSetName) { case LifecycleStateParamSet: response = client.Waiters.ForProject(request, waiterConfig, WaitForLifecycleState).Execute(); break; case Default: response = client.GetProject(request).GetAwaiter().GetResult(); break; } WriteOutput(response, response.Project); }
protected override void ProcessRecord() { base.ProcessRecord(); GetProjectRequest request; try { request = new GetProjectRequest { ProjectId = ProjectId, OpcRequestId = OpcRequestId }; HandleOutput(request); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
public static void CanGetProject(IBaseSpaceClient client, string[] includeStrings = null) { var project = CreateRandomTestProject(client); ListProjectsResponse listProjectResponse = client.ListProjects(new ListProjectsRequest() { Limit = 1, Offset = 0, Name = project.Name }); Assert.True(listProjectResponse.Response.Items.Length == 1); var compactProject = listProjectResponse.Response.Items[0]; Assert.True(project.Id == compactProject.Id); Assert.True(project.Name == compactProject.Name); var getProjRequest = new GetProjectRequest(compactProject.Id); if (includeStrings != null && includeStrings.Length > 0) { getProjRequest.Include = includeStrings; } var getProjectResponse = client.GetProject(new GetProjectRequest(compactProject.Id) { Include = new[] { ProjectIncludes.PERMISSIONS } }); var retrievedProject = getProjectResponse.Response; Assert.True(project.Id == retrievedProject.Id); Assert.True(project.Name == retrievedProject.Name); Assert.True(project.HrefAppResults == retrievedProject.HrefAppResults); Assert.True(project.HrefBaseSpaceUI == retrievedProject.HrefBaseSpaceUI); Assert.True(project.HrefSamples == retrievedProject.HrefSamples); if (includeStrings != null && includeStrings.Length > 0) { Assert.NotNull(retrievedProject.Permissions); } }
public async stt::Task GetProjectRequestObjectAsync() { moq::Mock <Projects.ProjectsClient> mockGrpcClient = new moq::Mock <Projects.ProjectsClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetProjectRequest request = new GetProjectRequest { ProjectName = gagr::ProjectName.FromProject("[PROJECT]"), }; Project expectedResponse = new Project { ProjectName = gagr::ProjectName.FromProject("[PROJECT]"), Parent = "parent7858e4d0", ProjectId = "project_id43ad98b0", State = Project.Types.State.Unspecified, DisplayName = "display_name137f65c2", CreateTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), DeleteTime = new wkt::Timestamp(), Etag = "etage8ad7218", Labels = { { "key8a0b6e3c", "value60c16320" }, }, }; mockGrpcClient.Setup(x => x.GetProjectAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Project>(stt::Task.FromResult(expectedResponse), null, null, null, null)); ProjectsClient client = new ProjectsClientImpl(mockGrpcClient.Object, null); Project responseCallSettings = await client.GetProjectAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Project responseCancellationToken = await client.GetProjectAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async stt::Task GetRequestObjectAsync() { moq::Mock <Projects.ProjectsClient> mockGrpcClient = new moq::Mock <Projects.ProjectsClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClientForGlobalOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetProjectRequest request = new GetProjectRequest { Project = "projectaa6ff846", }; Project expectedResponse = new Project { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", CreationTimestamp = "creation_timestamp235e59a1", Quotas = { new Quota(), }, CommonInstanceMetadata = new Metadata(), XpnProjectStatus = "xpn_project_status547f92f1", DefaultServiceAccount = "default_service_accountdf12b0f2", UsageExportLocation = new UsageExportLocation(), Description = "description2cf9da67", SelfLink = "self_link7e87f12d", EnabledFeatures = { "enabled_featuresf1f398e0", }, DefaultNetworkTier = "default_network_tier69d9d1a9", }; mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Project>(stt::Task.FromResult(expectedResponse), null, null, null, null)); ProjectsClient client = new ProjectsClientImpl(mockGrpcClient.Object, null); Project responseCallSettings = await client.GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Project responseCancellationToken = await client.GetAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
protected override void ProcessRecord() { base.ProcessRecord(); GetProjectRequest request; try { request = new GetProjectRequest { WorkspaceId = WorkspaceId, ProjectKey = ProjectKey, OpcRequestId = OpcRequestId }; response = client.GetProject(request).GetAwaiter().GetResult(); WriteOutput(response, response.Project); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
public void GetRequestObject() { moq::Mock <Projects.ProjectsClient> mockGrpcClient = new moq::Mock <Projects.ProjectsClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClientForGlobalOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetProjectRequest request = new GetProjectRequest { Project = "projectaa6ff846", }; Project expectedResponse = new Project { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", CreationTimestamp = "creation_timestamp235e59a1", Quotas = { new Quota(), }, CommonInstanceMetadata = new Metadata(), XpnProjectStatus = Project.Types.XpnProjectStatus.Host, DefaultServiceAccount = "default_service_accountdf12b0f2", UsageExportLocation = new UsageExportLocation(), Description = "description2cf9da67", SelfLink = "self_link7e87f12d", EnabledFeatures = { "enabled_featuresf1f398e0", }, DefaultNetworkTier = Project.Types.DefaultNetworkTier.Premium, }; mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); ProjectsClient client = new ProjectsClientImpl(mockGrpcClient.Object, null); Project response = client.Get(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public List <ProjectList> ProjectList(GetProjectRequest objreq) { try { List <SqlParameter> objparams = new List <SqlParameter>(); if (objreq != null) { if (objreq.ProjectId != null) { objparams.Add(new SqlParameter("@projectId", objreq.ProjectId)); } if (objreq.ProjectManagerId != null) { objparams.Add(new SqlParameter("@projectManagerId", objreq.ProjectManagerId)); } } return(DBConnect.ExecuteStoredProcedure <ProjectList>(PMSModels.Constants.USPConstants.GetProjects, (objparams.Count > 0?objparams:null))); } catch (Exception ex) { return(null); } }
public void CanGetAppResults() { var project = TestHelpers.CreateRandomTestProject(Client); var appResult1 = TestHelpers.CreateRandomTestAppResult(Client, project); var appResult2 = TestHelpers.CreateRandomTestAppResult(Client, project); var appResult3 = TestHelpers.CreateRandomTestAppResult(Client, project); Assert.NotNull(appResult1); Assert.NotNull(appResult2); Assert.NotNull(appResult3); var getProjectRequest = new GetProjectRequest(project.Id); var getProjectResponse = Client.GetProject(getProjectRequest); Assert.NotNull(getProjectResponse); var project2 = getProjectResponse.Response; Assert.NotNull(project2); var hrefAppResults = project2.HrefAppResults; Assert.NotNull(hrefAppResults); Assert.IsTrue(project2.Href.ToString().Contains(project2.Id)); }
public void GetProjectResourceNames() { moq::Mock <Projects.ProjectsClient> mockGrpcClient = new moq::Mock <Projects.ProjectsClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetProjectRequest request = new GetProjectRequest { ProjectName = gagr::ProjectName.FromProject("[PROJECT]"), }; Project expectedResponse = new Project { ProjectName = gagr::ProjectName.FromProject("[PROJECT]"), Parent = "parent7858e4d0", ProjectId = "project_id43ad98b0", State = Project.Types.State.Unspecified, DisplayName = "display_name137f65c2", CreateTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), DeleteTime = new wkt::Timestamp(), Etag = "etage8ad7218", Labels = { { "key8a0b6e3c", "value60c16320" }, }, }; mockGrpcClient.Setup(x => x.GetProject(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); ProjectsClient client = new ProjectsClientImpl(mockGrpcClient.Object, null); Project response = client.GetProject(request.ProjectName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public Task <GetProjectResponse> GetProjectAsync(GetProjectRequest request, IRequestOptions options = null) { return(WebClient.SendAsync <GetProjectResponse>(HttpMethods.GET, request.BuildUrl(ClientSettings.Version), null, options)); }
public async Task <ProjectDisplayModel> Handle(GetProjectRequest message, CancellationToken cancellationToken) { return((await _documentDataContext.Projects.FirstOrDefaultAsync(p => !p.IsDeleted && p.Id == message.ProjectId, cancellationToken: cancellationToken)).ToModel()); }
public IList <Project> Handle(GetProjectRequest query) { return(this.repository.Query <Entity.Project>().ProjectTo <Project>().ToList()); }
public GetProjectResponse GetProject(GetProjectRequest request, IRequestOptions options = null) { return(WebClient.Send(request, options)); }
public static string BuildUrl(this GetProjectRequest req, string version) { return(string.Format("{0}/projects/{1}", version, req.Id)); }
/// <summary> /// Creates a waiter using default wait configuration. /// </summary> /// <param name="request">Request to send.</param> /// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param> /// <returns>a new Oci.common.Waiter instance</returns> public Waiter <GetProjectRequest, GetProjectResponse> ForProject(GetProjectRequest request, params ProjectLifecycleState[] targetStates) { return(this.ForProject(request, WaiterConfiguration.DefaultWaiterConfiguration, targetStates)); }