public void Dashboard_fetch_does_not_return_deleted_entries() { Mapper.Reset(); AutoMapperConfig.RegisterMappings(); var store = new TestableStore(); int entryCount = 2; using (var entriesDashboardController = new EntriesDashboardController(store)) { using (var session = store.OpenSession()) { PersistTestEntries(session, entryCount, true); RavenControllerTestHelper.SetSessionOnController(entriesDashboardController, session); var queryModel = GetDefaultQueryModel(); var actionResult = entriesDashboardController.Fetch(queryModel); var entryEditModels = GetEntryEditModelsFromResult(actionResult); Assert.Empty(entryEditModels); } } }
public void Dashboard_fetch_crafts_viewmodels_from_database() { Mapper.Reset(); AutoMapperConfig.RegisterMappings(); var store = new TestableStore(); int entryCount = 2; using (var entriesDashboardController = new EntriesDashboardController(store)) { using (var session = store.OpenSession()) { PersistTestEntries(session, entryCount); RavenControllerTestHelper.SetSessionOnController(entriesDashboardController, session); var queryModel = GetDefaultQueryModel(); var actionResult = entriesDashboardController.Fetch(queryModel); var entryEditModels = GetEntryEditModelsFromResult(actionResult); for(int i = 0; i < entryCount; i++) { Assert.True(entryEditModels.Any(editModel => editModel.Id == Entry.IdPrefix + i)); } } } }
public void Dashboard_fetch_paginates_results() { Mapper.Reset(); AutoMapperConfig.RegisterMappings(); var store = new TestableStore(); int entryCount = 30; using (var entriesDashboardController = new EntriesDashboardController(store)) { using (var session = store.OpenSession()) { PersistTestEntries(session, entryCount); RavenControllerTestHelper.SetSessionOnController(entriesDashboardController, session); var queryModel = GetDefaultQueryModel(); var actionResult = entriesDashboardController.Fetch(queryModel); var entryEditModels = GetEntryEditModelsFromResult(actionResult); Assert.Equal(queryModel.PageSize, entryEditModels.Count()); } } }