public void CanGetEmptyCollection() { using (var store = NewDocumentStore()) { new CasinosSuspensionsIndex().Execute(store); using (var documentSession = store.OpenSession()) { var casino = new Casino("cities/1", "address", "name") { Suspensions = new List <Suspension>() { new Suspension(DateTime.UtcNow, new List <Exemption>()) } }; documentSession.Store(casino); documentSession.SaveChanges(); var suspensions = documentSession.Query <CasinosSuspensionsIndex.IndexResult, CasinosSuspensionsIndex>(). Customize(x => x.WaitForNonStaleResults()). Where(x => x.CityId == "cities/1"). OrderByDescending(x => x.DateTime). Take(10). AsProjection <CasinosSuspensionsIndex.IndexResult>(). ToList(); Assert.True(suspensions.All(x => x.Exemptions != null)); } } }
public void CanGetEmptyCollection() { using (var store = NewDocumentStore()) { new CasinosSuspensionsIndex().Execute(store); using (var documentSession = store.OpenSession()) { var casino = new Casino("cities/1", "address", "name") { Suspensions = new List <Suspension>() { new Suspension(DateTime.UtcNow, new List <Exemption>()) } }; documentSession.Store(casino); documentSession.SaveChanges(); var suspensions = documentSession.Query <CasinosSuspensionsIndex.IndexResult, CasinosSuspensionsIndex>(). Customize(x => x.WaitForNonStaleResults()). Where(x => x.CityId == "cities/1"). OrderByDescending(x => x.DateTime). Take(10). AsProjection <CasinosSuspensionsIndex.IndexResult>(). ToList(); // note that suspensions[0].Exemptions will be null, because we don't have // any values in the array, and we don't store empty arrays Assert.NotEmpty(suspensions); } } }