-
Notifications
You must be signed in to change notification settings - Fork 4
Article Test HW WangKE #4
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: main
Are you sure you want to change the base?
Conversation
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.
repository test is same as service test, why need this?
response.EnsureSuccessStatusCode(); | ||
var body = await response.Content.ReadAsStringAsync(); | ||
var users = JsonConvert.DeserializeObject<List<User>>(body); | ||
Assert.Equal(0, users.Count); | ||
Assert.True(users.Count == 0); |
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: use Equal instead of True, since if the test faild the message will give more detail
StringContent content = new StringContent(userJson, Encoding.UTF8, MediaTypeNames.Application.Json); | ||
|
||
// when | ||
var registerResponse = await client.PostAsync("/user", content); |
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: can use PostAsJsonAsync instead
No description provided.