0
我正在构建一个使用Web 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
?