Skip to main content
added 510 characters in body
Source Link
Matt Warren
  • 10.3k
  • 7
  • 52
  • 64

After you've run your unit test, just assert that there is a new doc in the database and that it has the right fields set.

var newDoc = session.Load<T>(docId) 

or

var docs = session.Query<T>.Where(....).ToList(); 

RavenDB in-memory mode is there so that you don't have to mock it out, you just do the following:

  • Open a new in-memory embedded doc store (with no data)
  • If needed insert any data your unit test needs to run
  • RUN the unit test
  • Look at the data in the in-memory store and see if it has been updated correctly

Update If you want a full sample, take a look at how the RacoonBlog code does it, this is the code running Ayende's blog. See these 2 files:

After you've run your unit test, just assert that there is a new doc in the database and that it has the right fields set.

var newDoc = session.Load<T>(docId) 

or

var docs = session.Query<T>.Where(....).ToList(); 

RavenDB in-memory mode is there so that you don't have to mock it out, you just do the following:

  • Open a new in-memory embedded doc store (with no data)
  • If needed insert any data your unit test needs to run
  • RUN the unit test
  • Look at the data in the in-memory store and see if it has been updated correctly

After you've run your unit test, just assert that there is a new doc in the database and that it has the right fields set.

var newDoc = session.Load<T>(docId) 

or

var docs = session.Query<T>.Where(....).ToList(); 

RavenDB in-memory mode is there so that you don't have to mock it out, you just do the following:

  • Open a new in-memory embedded doc store (with no data)
  • If needed insert any data your unit test needs to run
  • RUN the unit test
  • Look at the data in the in-memory store and see if it has been updated correctly

Update If you want a full sample, take a look at how the RacoonBlog code does it, this is the code running Ayende's blog. See these 2 files:

added 2 characters in body
Source Link
Matt Warren
  • 10.3k
  • 7
  • 52
  • 64

After you've run your unit test, just assert that there is a new doc in the database and that it has the right fields set.

var newDoc = session.Load<T>(docId) 

or var docs = session.Query.Where(....).ToList();

var docs = session.Query<T>.Where(....).ToList(); 

RavenDB in-memory mode is there so that you don't have to mock it out, you just do the following:

  • Open a new in-memory embedded doc store (with no data)
  • If needed insert any data your unit test needs to run
  • RUN the unit test
  • Look at the data in the in-memory store and see if it has been updated correctly

After you've run your unit test, just assert that there is a new doc in the database and that it has the right fields set.

var newDoc = session.Load<T>(docId) 

or var docs = session.Query.Where(....).ToList();

RavenDB in-memory mode is there so that you don't have to mock it out, you just do the following:

  • Open a new in-memory embedded doc store (with no data)
  • If needed insert any data your unit test needs to run
  • RUN the unit test
  • Look at the data in the in-memory store and see if it has been updated correctly

After you've run your unit test, just assert that there is a new doc in the database and that it has the right fields set.

var newDoc = session.Load<T>(docId) 

or

var docs = session.Query<T>.Where(....).ToList(); 

RavenDB in-memory mode is there so that you don't have to mock it out, you just do the following:

  • Open a new in-memory embedded doc store (with no data)
  • If needed insert any data your unit test needs to run
  • RUN the unit test
  • Look at the data in the in-memory store and see if it has been updated correctly
Source Link
Matt Warren
  • 10.3k
  • 7
  • 52
  • 64

After you've run your unit test, just assert that there is a new doc in the database and that it has the right fields set.

var newDoc = session.Load<T>(docId) 

or var docs = session.Query.Where(....).ToList();

RavenDB in-memory mode is there so that you don't have to mock it out, you just do the following:

  • Open a new in-memory embedded doc store (with no data)
  • If needed insert any data your unit test needs to run
  • RUN the unit test
  • Look at the data in the in-memory store and see if it has been updated correctly