RavenTestDriver database name

29 views
Skip to first unread message

Alexandru Puiu

unread,
Dec 16, 2022, 12:59:57 PM12/16/22
to RavenDB - an awesome database
Hi,
I'm trying to use the RavenTestDriver in xunit tests to test the output of my APIs, but can't find a way to insert data into the database the API will use when querying.

in the constructor I inject a WebApplicationFactory, pass a config with the url and name of the database and start the app with WithWebHostBuilde saving a reference to the HttpClient it created

in the test body I open a session and save the documents I expect the API to return
then I call the api
the name of the database is different in the constructor, in the test, and in the API method. How can I get a predictable name for the database?

Thanks

Oren Eini (Ayende Rahien)

unread,
Dec 17, 2022, 5:48:46 AM12/17/22
to rav...@googlegroups.com
You need to call GetDocumentStore() *once* for your test. It will spawn its dedicated database for you.
Once you have the document store, create multiple sessions for it.

--
You received this message because you are subscribed to the Google Groups "RavenDB - an awesome database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ravendb/1ce18f5a-0732-4044-a378-3dfca30b163bn%40googlegroups.com.


--
Oren Eini
CEO   /   Hibernating Rhinos LTD
Skype:  ayenderahien
Support:  sup...@ravendb.net
  
Reply all
Reply to author
Forward
0 new messages