public async Task IssueRepository_GetIssueWithDetails_ShouldReturnCorrectItem(string id) { var guidId = Guid.Parse(id); await using var context = new TimeTrackingDbContext(_dbOptions); var issueRepository = new IssueRepository(context); var expected = IssuesDbSet.Get().First(x => x.Id == guidId); var expectedMilestone = MilestonesDbSet.Get().First(e => e.Id == expected.MilestoneId); var expectedWorkLogs = WorklogsDbSet.Get().Where(e => e.IssueId == expected.Id).OrderBy(e => e.Id).ToList(); var expectedTimeTrackingUserReporter = UsersDbSet.Get().First(e => e.Id == expected.ReportedByUserId); var expectedTimeTrackingUserAssigned = UsersDbSet.Get().First(e => e.Id == expected.AssignedToUserId); var issue = await issueRepository.GetIssueWithDetails(guidId); Assert.That(issue, Is.EqualTo(expected).Using(EqualityComparers.IssueComparer)); Assert.That(issue.Milestone, Is.EqualTo(expectedMilestone).Using(EqualityComparers.MilestoneComparer)); Assert.That(issue.WorkLogs.ToList(), Is.EqualTo(expectedWorkLogs).Using(EqualityComparers.WorkLogComparer)); Assert.That(issue.TimeTrackingUserReporter, Is.EqualTo(expectedTimeTrackingUserReporter).Using(EqualityComparers.TimeTrackingUserComparer)); Assert.That(issue.TimeTrackingUserAssigned, Is.EqualTo(expectedTimeTrackingUserAssigned).Using(EqualityComparers.TimeTrackingUserComparer)); }