public async void ListWorkDeveloperAsync(bool withFilter) { var project = EntitiesFactory.NewProject(developerIds: new[] { SessionDeveloper.Id }).Save(); var query = new DeveloperWorkSearchClientDto { Page = 1, Limit = 1, ProjectId = withFilter ? (Guid?)project.Id : null }; EntitiesFactory.NewWork(Guid.NewGuid(), project.DeveloperProjects.Single().Id).Save(); EntitiesFactory.NewWork(Guid.NewGuid(), project.DeveloperProjects.Single().Id).Save(); var(status, result) = await Request.GetAsync <ResultTest <IEnumerable <DeveloperWorkListDto> > >(new Uri($"{Uri}/{SessionDeveloper.Id}/works"), query); var workList = result.Data; Assert.Equal(Status.Success, status); Assert.NotEmpty(workList); Assert.True(result.TotalRows > 0); Assert.True(workList.Count() == query.Limit); Assert.All(workList, work => { Assert.True(work.Hours > 0); Assert.NotEmpty(work.Comment); Assert.NotNull(work.Project); if (withFilter) { Assert.Equal(project.Id, work.Project.Id); Assert.Equal(project.Title, work.Project.Title); } }); }
public async Task <Result <IEnumerable <DeveloperWorkListDto> > > ListWorkProjectsAsync([FromQuery] DeveloperWorkSearchClientDto searchDto, [FromRoute] Guid id) { return(GetResult(await _developerService.ListDeveloperWorksAsync(new DeveloperWorkSearchDto(searchDto, id)))); }