웹 API와 Raven DB를 사용하여 시스템을 구축 중입니다.Raven Db로 경계 테스트
이 시스템의 외부 경계에 대한 통합 테스트를 작성하고 있습니다. 내가 항목을 제출하면 그게 생산에서 작동하는 방법이기 때문에
public void GetAfterPostingPollReturnsPoll()
{
using (var client = HttpClientFactory.Create())
{
var poll = new
{
Question = "What is the answer?",
Options = new[] { "Yes", "No", "Maybe" }
};
var postResponse = client.PostAsJsonAsync("", poll).Result;
var pollLocation = postResponse.Headers.Location;
var getResponse = client.GetAsync(pollLocation).Result;
var actual = JsonConvert.DeserializeObject<Poll>(
getResponse.Content
.ReadAsStringAsync()
.Result);
Assert.Equal(poll.Question, actual.Question);
Assert.Equal(poll.Options, actual.Options);
}
}
는 Controller
는 DocumentStore
와 상호 작용합니다.
내가 겪고있는 문제는 테스트에서 생성 된 데이터가 정리되지 않는다는 것입니다.
내가 읽은 바를 토대로 수락 테스트를 위해 EmbeddableDocumentStore
을 사용해야합니다.
DocumentStore
은 일반적으로 사용하지만 EmbeddableDocumentStore
과 같이 경계 테스트를 수행 할 때 어떻게 사용할 수 있습니까?