Hey, new guy to ravendb so this could just be bad code, but here's the situation.
I've got 2 repositories, one for a data import, and one for read ops. The integration test works (generally) like this
using (var fileRepo = new FileUploadsRepository())
{
var rates = new List<Rate>
{
new Rate {RiskCategory = "A+", LoanRate = 4.2M },
//...snip...
new Rate {RiskCategory = "F-, no banana", LoanRate = 48.2M },
};
fileRepo.ReplaceRates(rates);
}
using (var ratesRepo = new RatesRepository())
{
var rs = ratesRepo.GetRates();
Assert.AreEqual(6, rs.Count);
}
The code behind the file uploads repo is pretty simplistic
public void ReplaceRates(List<Rate> items)
{
var staleItems = Session.Query<Rate>().ToList();
staleItems.ForEach(i => Session.Delete(i));
items.ForEach(i => Session.Store(i));
Session.SaveChanges();
}
The code behind the rates repository is similarly simplistic
public List<Rate> GetRates()
{
return Session.Query<Rate>().ToList();
}
The test fails with the message Expected 6, actual 0 results returned. I'd accept this as some sort of eventual consistency except the console log seems to indicate that there are indeed 6 items there to return and for some reason my code isn't asking for them correctly.
Ouery: Tag:Rates
Time: 1ms
Index Raven/DocumentsByEntityName
Results: 0 returned out of 6 total
Hopefully someone here can tell me what I'm doing wrong.