コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
        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));
                    }
                }
            }
        }
コード例 #3
0
        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());
                }
            }
        }