Hi, thank you very much for the tutorial ! It helps me to know how to test the SendAsync function.
However, I'm little confused with the assert action. Usually we will compare the unit test result with our expectation result, and we put inside the "assert" part. In your example, where do you put the assert? Thanks :)
In the first test you see I do the assert Assert.NotNull(retrievedPosts);, so it's there I would have it. Because my demo code GetPosts and CreatePost is simple it doesn't feel natural to add more assertions. But maybe one I could have added was Assert.Equal(2, retrievedPosts.Count); instead of Assert.NotNull(retrievedPosts); and there is where I would put it.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi, thank you very much for the tutorial ! It helps me to know how to test the SendAsync function.
However, I'm little confused with the assert action. Usually we will compare the unit test result with our expectation result, and we put inside the "assert" part. In your example, where do you put the assert? Thanks :)
Hi thanks for the comment :)
In the first test you see I do the assert
Assert.NotNull(retrievedPosts);
, so it's there I would have it. Because my demo codeGetPosts
andCreatePost
is simple it doesn't feel natural to add more assertions. But maybe one I could have added wasAssert.Equal(2, retrievedPosts.Count);
instead ofAssert.NotNull(retrievedPosts);
and there is where I would put it.