Created
July 23, 2019 07:38
-
-
Save ntakouris/1bc8792bf236bd67b7ff3fd64311d84c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public async Task Get_WhenPostExistsInTheDatabase_ReturnsPost() | |
{ | |
// Arrange | |
await AuthenticateAsync(); | |
var createdPost = await CreatePostAsync(new CreatePostRequest {Name = "Test post"}); | |
// Act | |
var response = await TestClient.GetAsync(ApiRoutes.Posts.Get.Replace("{postId}", createdPost.Id.ToString())); | |
// Assert | |
response.StatusCode.Should().Be(HttpStatusCode.OK); | |
var returnedPost = await response.Content.ReadAsAsync<Post>(); | |
returnedPost.Id.Should().Be(createdPost.Id); | |
returnedPost.Name.Should().Be("Test post"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment