public void Setup() { _container = new MocksAndStubsContainer(); _applicationSettings = _container.ApplicationSettings; _context = _container.UserContext; _settingsRepository = _container.SettingsRepository; _userRepository = _container.UserRepository; _pageRepository = _container.PageRepository; _settingsService = _container.SettingsService; _userService = _container.UserService; _pageCache = _container.PageViewModelCache; _listCache = _container.ListCache; _siteCache = _container.SiteCache; _cache = _container.MemoryCache; _container.ClearCache(); _pageService = _container.PageService; _wikiImporter = new WikiImporterMock(); _pluginFactory = _container.PluginFactory; _searchService = _container.SearchService; // There's no point mocking WikiExporter (and turning it into an interface) as // a lot of usefulness of these tests would be lost when creating fake Streams and zip files. _wikiExporter = new WikiExporter(_applicationSettings, _pageService, _settingsRepository, _pageRepository, _userRepository, _pluginFactory); _wikiExporter.ExportFolder = AppDomain.CurrentDomain.BaseDirectory; _toolsController = new ToolsController(_applicationSettings, _userService, _settingsService, _pageService, _searchService, _context, _listCache, _pageCache, _wikiImporter, _pluginFactory, _wikiExporter); }
public void Setup() { _container = new MocksAndStubsContainer(); _applicationSettings = _container.ApplicationSettings; _context = _container.UserContext; _settingsRepository = _container.SettingsRepository; _userRepository = _container.UserRepository; _pageRepository = _container.PageRepository; _settingsService = _container.SettingsService; _userService = _container.UserService; _pageCache = _container.PageViewModelCache; _listCache = _container.ListCache; _siteCache = _container.SiteCache; _cache = _container.MemoryCache; _container.ClearCache(); _pageService = _container.PageService; _wikiImporter = new WikiImporterMock(); _pluginFactory = _container.PluginFactory; _searchService = _container.SearchService; // There's no point mocking WikiExporter (and turning it into an interface) as // a lot of usefulness of these tests would be lost when creating fake Streams and zip files. _wikiExporter = new WikiExporter(_applicationSettings, _pageService, _settingsRepository, _pageRepository, _userRepository, _pluginFactory); _wikiExporter.ExportFolder = AppDomain.CurrentDomain.BaseDirectory; _toolsController = new ToolsController(_applicationSettings, _userService, _settingsService, _pageService, _searchService, _context, _listCache, _pageCache, _wikiImporter, _pluginFactory, _wikiExporter); }
public void Setup() { _container = new MocksAndStubsContainer(); _container.ClearCache(); _applicationSettings = _container.ApplicationSettings; _context = _container.UserContext; _pageRepository = _container.PageRepository; _settingsService = _container.SettingsService; _userService = _container.UserService; _pageCache = _container.PageViewModelCache; _listCache = _container.ListCache; _siteCache = _container.SiteCache; _cache = _container.MemoryCache; _cacheController = new CacheController(_applicationSettings, _userService, _settingsService, _context, _listCache, _pageCache, _siteCache); }
public void Setup() { _container = new MocksAndStubsContainer(); _container.ClearCache(); _applicationSettings = _container.ApplicationSettings; _context = _container.UserContext; _pageRepository = _container.PageRepository; _settingsService = _container.SettingsService; _userService = _container.UserService; _pageCache = _container.PageViewModelCache; _listCache = _container.ListCache; _siteCache = _container.SiteCache; _cache = _container.MemoryCache; _cacheController = new CacheController(_applicationSettings, _userService, _settingsService, _context, _listCache, _pageCache, _siteCache); }
public void Setup() { _container = new MocksAndStubsContainer(); _container.ClearCache(); _applicationSettings = _container.ApplicationSettings; _applicationSettings.AttachmentsFolder = AppDomain.CurrentDomain.BaseDirectory; _context = _container.UserContext; _settingsRepository = _container.SettingsRepository; _settingsService = _container.SettingsService; _userService = _container.UserService; _pageCache = _container.PageViewModelCache; _listCache = _container.ListCache; _siteCache = _container.SiteCache; _cache = _container.MemoryCache; _configReaderWriter = new ConfigReaderWriterStub(); _settingsController = new SettingsController(_applicationSettings, _userService, _settingsService, _context, _siteCache, _configReaderWriter); }
public void Setup() { _container = new MocksAndStubsContainer(); _container.ClearCache(); _applicationSettings = _container.ApplicationSettings; _applicationSettings.AttachmentsFolder = AppDomain.CurrentDomain.BaseDirectory; _context = _container.UserContext; _settingsRepository = _container.SettingsRepository; _settingsService = _container.SettingsService; _userService = _container.UserService; _pageCache = _container.PageViewModelCache; _listCache = _container.ListCache; _siteCache = _container.SiteCache; _cache = _container.MemoryCache; _configReaderWriter = new ConfigReaderWriterStub(); _settingsController = new SettingsController(_applicationSettings, _userService, _settingsService, _context, _siteCache, _configReaderWriter); }
public void updatelinkstopage_should_clear_cache() { // Arrange _container.ClearCache(); _pageRepository.AddNewPage(new Page() { Id = 1, Title = "Homepage" }, "This is a link to [[About page title|About]]", "editor", DateTime.UtcNow); _pageRepository.AddNewPage(new Page() { Id = 2, Title = "About page title" }, "This is a link to [[Homepage|Back home]]", "editor", DateTime.UtcNow); _pageViewModelCache.Add(1, new PageViewModel()); _pageViewModelCache.Add(2, new PageViewModel()); _listCache.Add("somekey", new List <string>()); // Act _pageService.UpdateLinksToPage("About page title", "New title"); // Assert Assert.That(_pageViewModelCache.GetAllKeys().Count(), Is.EqualTo(0)); Assert.That(_listCache.GetAllKeys().Count(), Is.EqualTo(0)); }