public async Task GetActivitiesForUser_WhenUserNotFound_ReturnsUserNotFoundResponse()
        {
            var request = new ActivitiesRequest()
            {
                ProjectId = ProjectsDbSet.Get().First().Id,
                UserId    = Guid.NewGuid()
            };

            var httpResponse = await GetAsync(WorkLogControllerRoutes.GetUserWorkLogs + "?" + request.ToQueryString());

            httpResponse.EnsureSuccessStatusCode();
            var response = await httpResponse.BodyAs <ApiResponse <UserActivityDto> >();

            response.VerifyNotSuccessResponseWithErrorCodeAndMessage(ErrorCode.UserNotFound);
        }
        public async Task GetActivitiesForUser_WhenModelValid_ReturnsUserActivities()
        {
            var user    = UsersDbSet.Get().First();
            var request = new ActivitiesRequest()
            {
                ProjectId = ProjectsDbSet.Get().First().Id,
                UserId    = user.Id
            };
            var workLogItems = WorklogsDbSet.Get().Where(e => e.UserId.Equals(request.UserId))
                               .Include(e => e.Issue)
                               .ThenInclude(e => e.Project)
                               .Where(e => e.Issue.ProjectId.Equals(request.ProjectId));
            var httpResponse = await GetAsync(WorkLogControllerRoutes.GetUserWorkLogs + "?" + request.ToQueryString());

            httpResponse.EnsureSuccessStatusCode();
            var response = await httpResponse.BodyAs <ApiResponse <UserActivityDto> >();

            response.VerifySuccessResponse();
            response.Data.UserId.Should().Be(request.UserId);
            response.Data.UserName.Should().Be(user.FirstName);
            response.Data.UserSurname.Should().Be(user.LastName);
            response.Data.UserEmail.Should().Be(user.Email);
            response.Data.ProjectName.Should().Be(workLogItems?.Select(e => e.Issue.Project.Name).FirstOrDefault());
            response.Data.TotalWorkLogInSeconds.Should().Be((long?)workLogItems?.Sum(e => e.TimeSpent));
            response.Data.WorkLogItems.Should()
            .BeEquivalentTo(workLogItems?.Select(e => GetWorkLogDetails(e)).ToList());
            await ReSeedDatabase();
        }
        public async Task GetActivitiesForUser_WhenModelNotValid_ReturnsValidationErrors()
        {
            //project id not set
            var request = new ActivitiesRequest()
            {
                ProjectId = Guid.Empty,
                UserId    = Guid.NewGuid()
            };
            var httpResponse = await GetAsync(WorkLogControllerRoutes.GetUserWorkLogs + "?" + request.ToQueryString());

            httpResponse.EnsureSuccessStatusCode();
            var response = await httpResponse.BodyAs <ApiResponse <UserActivityDto> >();

            response.CheckValidationException(1);

            //user id not set
            request = new ActivitiesRequest()
            {
                ProjectId = Guid.NewGuid(),
                UserId    = Guid.Empty
            };
            httpResponse = await GetAsync(WorkLogControllerRoutes.GetUserWorkLogs + "?" + request.ToQueryString());

            httpResponse.EnsureSuccessStatusCode();
            response = await httpResponse.BodyAs <ApiResponse <UserActivityDto> >();

            response.CheckValidationException(1);

            //empty request
            request = new ActivitiesRequest()
            {
            };
            httpResponse = await GetAsync(WorkLogControllerRoutes.GetUserWorkLogs + "?" + request.ToQueryString());

            httpResponse.EnsureSuccessStatusCode();
            response = await httpResponse.BodyAs <ApiResponse <UserActivityDto> >();

            response.CheckValidationException(2);
        }