public async Task PostCommentShouldResultsWithSingleCommentWasAdded() { //Given var randomOwner = _guidGenerator.GenerateString(); var randomRepository = _guidGenerator.GenerateString(); var repositoryId = new RepositoryId(randomOwner, randomRepository); var pullRequestId = _guidGenerator.GenerateString(); //When var postRequest = new { Url = $"/rest-api/{randomOwner}/{randomRepository}/pulls/{pullRequestId}/comments", Body = new { Text = "Comment text", Author = "LoggedUser" } }; var response = await _client.PostAsync(postRequest.Url, postRequest.Body.ToJson()); //Then var responseBody = JsonConvert.DeserializeObject <PostCommentResponseBody>(await response.Content.ReadAsStringAsync()); var expectedStreamName = $"PullRequestComment-{responseBody.CommentId}"; var streamLastEvent = await _eventStore.StreamLastEvent(expectedStreamName, _eventSerializer); streamLastEvent.Should().BeEquivalentTo( new SingleCommentWasAdded ( pullRequestId: pullRequestId, repositoryId: repositoryId.ToString(), commentId: responseBody.CommentId, author: "LoggedUser", text: "Comment text", occurredAt: _clock.Now ) ); }