-
Notifications
You must be signed in to change notification settings - Fork 4
Yuhua's PR AC 1-7 #1
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
base: master
Are you sure you want to change the base?
Conversation
|
||
if ((pageIndex * pageSize) > companies.Count()) | ||
{ | ||
return StatusCode(StatusCodes.Status204NoContent); |
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.
well: nice to use 204 for no found related data
suggestion: also return empty list to client
{ | ||
return StatusCode(StatusCodes.Status204NoContent); | ||
} | ||
var ressultCompanies = companies.Skip((int)((pageIndex - 1) * pageSize)).Take((int)pageSize).ToList(); |
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.
well: nice to use Skip Take
sugesstion: extract (pageIndex-1) * pageSize to a temp variable
var company = companies.Find(company => company.Id.Equals(id)); | ||
if (company == null) | ||
{ | ||
return NotFound(); |
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.
well: nice to return 404 if not found company
PUT https://{{hostname}}:{{port}}/api/Companies/{companyID}/employee/{employeeId} | ||
Content-Type: application/json; charset=utf-8 | ||
|
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.
suggestion: add request body for update company
@@ -20,6 +23,75 @@ public ActionResult<Company> Create(CreateCompanyRequest request) | |||
return StatusCode(StatusCodes.Status201Created, companyCreated); | |||
} | |||
|
|||
[HttpGet] |
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.
good code logic
} | ||
|
||
[Fact] | ||
public async Task Should_return_companies_with_status_200_when_get_company_given_page_and_index() |
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.
Suggest add one test case(such as pageIndex = -1 & pageSize = -2)
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.
maybe this case make code logic success, but not satisfied
No description provided.