Skip to content
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

Merged
merged 5 commits into from
Sep 8, 2021

Conversation

P0linux
Copy link
Contributor

@P0linux P0linux commented Aug 19, 2021

No description provided.

@@ -113,22 +113,20 @@ private IEnumerable<DirectionStatistic> FakeDirectionStatistics()
};
}

private IEnumerable<WorkshopDTO> FakeWorkshops()
private IEnumerable<WorkshopCard> FakeWorkshopCards()
Copy link
Contributor

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>
Copy link
Contributor

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);
Copy link
Contributor

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.

Copy link
Contributor Author

@P0linux P0linux Sep 5, 2021

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>(),
Copy link
Contributor

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");
Copy link
Contributor

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 ?

@P0linux P0linux force-pushed the Krasnova/Statistic_GetWorkshops_Update branch from 274296c to 252a366 Compare September 5, 2021 15:01
@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 5, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@DmyMi DmyMi merged commit 5df649e into develop Sep 8, 2021
@DmyMi DmyMi deleted the Krasnova/Statistic_GetWorkshops_Update branch September 8, 2021 07:33
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