-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Krasnova/statistic get workshops update #278
Conversation
@@ -113,22 +113,20 @@ private IEnumerable<DirectionStatistic> FakeDirectionStatistics() | |||
}; | |||
} | |||
|
|||
private IEnumerable<WorkshopDTO> FakeWorkshops() | |||
private IEnumerable<WorkshopCard> FakeWorkshopCards() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change return type to List...
Could we randomize this test data ?
// Arrange | ||
var expected = new WorkshopDTO | ||
var expected = new List<WorkshopCard> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move creating of random data into separate methods
// Act | ||
var result = await service.GetPopularWorkshops(2).ConfigureAwait(false); | ||
|
||
// Assert | ||
result.Should().HaveCount(2); | ||
result.Should().ContainEquivalentOf(expected); | ||
result.Should().BeEquivalentTo(expected); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use CollectionAssert.AreEqual
It makes sure that both collections contains same items in the same order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could I use Should().BeEquivalentTo()
with option WithStrictOrdering instead?
It is supposed to do the same: comparing lists members considering ordering.
var directionsMock = directions.AsQueryable().BuildMock(); | ||
|
||
workshopRepository.Setup(w => w.Get<It.IsAnyType>( | ||
It.IsAny<int>(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen exact code in the previous test.
Can we move all generic setups in the separate method ?
{ | ||
logger.Information("Getting popular workshops started."); | ||
|
||
var workshops = workshopRepository.Get<int>(); | ||
var workshops = workshopRepository.Get<int>(includeProperties: "Address,Direction"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use something like a $"{nameof(Address)},{nameof(Direction)}" instead of string literal ?
274296c
to
252a366
Compare
Kudos, SonarCloud Quality Gate passed! |
No description provided.