单元测试 RavenDB [英] Unit Testing RavenDB

查看:48
本文介绍了单元测试 RavenDB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的单元测试中,我将每个测试设置为一个完全空的 IDocumentSession.我是这样做的:

In my unit tests I am setting up each test to have a totally empty IDocumentSession. I do it like this:

[SetUp]
public void SetUp()
{
  _store = new EmbeddableDocumentStore
  {
     RunInMemory = true
  };

  _store.Initialize();

  Session = _store.OpenSession();
}

但我认为这可能是我的测试有点慢的原因.我想知道是否有一个简单的命令可以从数据库中删除所有文档.

But I think this might be the reason my tests are a little slow. I was wondering if there is a simple command to delete all documents from the database.

我想知道的是:我是否可以做到这一点,以及它是否会提高性能.

What I want is to know is: if I can do this, and if it would improve performance.

推荐答案

这是使用 ravendb 进行单元测试的推荐方法不推荐用于生产的基本上在内存模式下运行如果您发现这很慢,请尝试分析并弄清楚到底是什么导致了速度变慢

This is the recommended approach for unit testing with ravendb The not recommended for production basically runs in the in memory mode If you find this to be slow, try profiling and figuring out what exactly is slowing things down

这篇关于单元测试 RavenDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆