-
Notifications
You must be signed in to change notification settings - Fork 14
Streetcode art&text unit tests #112
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
Conversation
|
|
||
| [Theory] | ||
| [InlineData(1)] | ||
| public async Task GetStreetcodeArtByStreetcodeId_ReturnsSuccesfullyStreetcodeArt(int streetcodeId) |
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.
move setup's to private method's. don't repeat yourself)
| It.IsAny<Func<IQueryable<StreetcodeArt>, IIncludableQueryable<StreetcodeArt, object>>>())) | ||
| .ReturnsAsync(GetStreetcodeArtsList()); | ||
|
|
||
| mockMapper.Setup(x => x.Map<IEnumerable<StreetcodeArtDTO>>(It.IsAny<IEnumerable<object>>())).Returns(GetStreetcodeArtDTOList()); |
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.
this one too.
|
|
||
| Assert.Multiple( | ||
| () => Assert.NotNull(result), | ||
| () => Assert.True(result.IsSuccess)); |
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.
As for me these checks are useless. If result is not null (first assert) that the result is obviously successful. Maybe it is better to check the type of result.Value. You can also check if the element was really deleted
Streetcode/Streetcode.XUnitTest/MediatRTests/StreetcodeTests/TextTests/DeleteTextTest.cs
Show resolved
Hide resolved
| .ReturnsAsync(testTexts); | ||
|
|
||
| repository.Setup(repo => repo.TextRepository.GetAllAsync(null, null)).ReturnsAsync(testTextsList); | ||
|
|
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.
why two repository setups?? the last hides the first one. Also move them to private methods)
Streetcode/Streetcode.XUnitTest/MediatRTests/StreetcodeTests/TextTests/GetAllTextsTest.cs
Show resolved
Hide resolved
Streetcode/Streetcode.XUnitTest/MediatRTests/StreetcodeTests/TextTests/GetAllTextsTest.cs
Show resolved
Hide resolved
| var result = await handler.Handle(new GetTextByIdQuery(2), CancellationToken.None); | ||
|
|
||
| Assert.NotNull(result); | ||
| Assert.True(result.IsSuccess); |
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.
multiple asserts
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.
not sure
dev
JIRA
Code reviewers
Second Level Review
Summary of issue
ToDo
Summary of change
ToDo
Testing approach
ToDo
CHECK LIST