Skip to content

test/32/add_tests_for_TimelineItem_handler_and_fix_request_Id_handling#39

Open
InnetaSh wants to merge 4 commits into
devfrom
fix/003_032/timelineitem_handlers
Open

test/32/add_tests_for_TimelineItem_handler_and_fix_request_Id_handling#39
InnetaSh wants to merge 4 commits into
devfrom
fix/003_032/timelineitem_handlers

Conversation

@InnetaSh
Copy link
Copy Markdown
Contributor

dev

JIRA

Code reviewers

  • @github_username

Second Level Review

  • @github_username

Summary of issue

Fix

Handler now correctly uses request.Id (previously ignored).

Test

Added missing unit tests for MediatR/Timeline/TimelineItem.

Related tasks:

bug/issues/3
test/issues/32

Summary of change

Fixed handler logic to correctly use request.Id
Added unit tests for TimelineItem MediatR handler

Testing approach

Added unit tests for TimelineItem handler
Covered cases:
valid Id processing
invalid / non-existing Id handling
edge cases (null/invalid input if applicable)
Verified tests locally

CHECK LIST

  • СI passed
  • Сode coverage >=95%
  • PR is reviewed manually again (to make sure you have 100% ready code)
  • All reviewers agreed to merge the PR
  • I've checked new feature as logged in and logged out user if needed
  • PR meets all conventions

@sonarqubecloud
Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

@InnetaSh InnetaSh self-assigned this May 10, 2026
It.IsAny<Func<IQueryable<TimelineItem>, IIncludableQueryable<TimelineItem, object>>>()))
.ReturnsAsync(timelineItems);

this.mapperMock
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This setup forces mapper to return "expectedDtos" regardless of input, meaning our test will always pass. Consider not to use mocked mapper, but mapper itself to fix this problem. Fix other tests, having the same problem.


var expectedDtos = new List<TimelineItemDTO>
{
new TimelineItemDTO
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you will use mapper itself, you can use Map() method here to ensure "expectedDtos" and an actual output of the handler to be the same


var result = await this.handler.Handle(query, CancellationToken.None);

Assert.True(result.IsSuccess);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest using fluent assertions and method BeEquivalentTo() to compare "result.Value" and "expectedDtos"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants