public void Run() { using (var documentStore = GetDocumentStore()) { using (var documentSession = documentStore.OpenSession()) { var cgc = new Cgc { Name = "Cgc" }; documentSession.Store(cgc); var production = new Production { Name = "Production", CgcId = cgc.Id }; documentSession.Store(production); var cgc2 = new Cgc { Name = "TwoCgc" }; documentSession.Store(cgc2); var production2 = new Production { Name = "TwoProduction", CgcId = cgc2.Id }; documentSession.Store(production2); documentSession.SaveChanges(); } new CgcAndProductionIndex().Execute(documentStore); WaitForIndexing(documentStore); using (var documentSession = documentStore.OpenSession()) { var results = documentSession .Query <CgcAndProduction, CgcAndProductionIndex>() .Customize(x => x.WaitForNonStaleResults()) .Where(x => x.CgcName == "TwoCgc" && x.ProductionName == "TwoProduction") .ToList(); Assert.Equal(1, results.Count); } } }
public override string ToString() { return($"Cliente:\t{Nome.Trim()}\tCPF:\t{Cgc.Trim()}"); }