public void GivenSomeSeedDataAndTwoIndexes_InitializeWithDefaults_WorksWithSomeDataAndTwoIndexes() { // Arrange. DataToBeSeeded = User.CreateFakeData().ToList(); // NOTE: Each collection has an identity counter (it is assumed). var numberOfDocuments = DataToBeSeeded.Cast <IList>().Sum(collection => collection.Count) + DataToBeSeeded.Count(); IndexesToExecute = new List <Type> { typeof(Users_Search), typeof(Users_TagsSummary) }; // Act. var documentSession = AsyncDocumentSession; // Assert. Assert.NotNull(documentSession); Assert.NotNull(DocumentStore); Assert.Equal(numberOfDocuments, DocumentStore.DatabaseCommands.GetStatistics().CountOfDocuments); Assert.Equal(IndexesToExecute.Count, DocumentStore.DatabaseCommands.GetStatistics().CountOfIndexes); }
public async Task GivenSomeSeedDataAndNoIndexesButOneResultTransformer_InitializeWithDefaults_WorksWithSomeDataAndNoIndexes() { // Arrange. DataToBeSeeded = User.CreateFakeData().ToList(); // NOTE: Each collection has an identity counter (it is assumed). int numberOfDocuments = DataToBeSeeded .Cast <IList>() .Sum(collection => collection.Count) + DataToBeSeeded.Count(); IndexesToExecute = new List <Type> { typeof(User_SearchTransformer) }; // Act. var documentSession = AsyncDocumentSession; new User_SearchTransformer().Execute(DocumentStore); // Assert. Assert.NotNull(documentSession); Assert.NotNull(DocumentStore); Assert.Equal(numberOfDocuments, DocumentStore.DatabaseCommands.GetStatistics().CountOfDocuments); // There's no way to find out how many result tranformers we have. Assert.Equal(0, DocumentStore.DatabaseCommands.GetStatistics().CountOfIndexes); }