public void SetupContext() { _dependencyProvider = new StubDependencyProvider(); _resourceFinder = new StubResourceFinder(); _dependencyCache = new InMemoryDependencyCache(); _scriptGroups = new ResourceGroupManager(ResourceMode.Debug); _styleGroups = new ResourceGroupManager(ResourceMode.Debug); _dependencyManager = new DependencyManager(_resourceFinder, _dependencyCache, _scriptGroups, _styleGroups); _dependencyManager.MapProvider(".js", _dependencyProvider); }
private void SetupWithMode(ResourceMode resourceMode) { _dependencyProvider = new StubDependencyProvider(); _resourceFinder = new StubResourceFinder(); _dependencyCache = new InMemoryDependencyCache(); _scriptGroups = new ResourceGroupManager(resourceMode); _styleGroups = new ResourceGroupManager(resourceMode); _dependencyManager = new DependencyManager(new ResourceModeFilteringFinder(resourceMode, _resourceFinder), _dependencyCache, _scriptGroups, _styleGroups, resourceMode); _dependencyManager.MapProvider(".js", _dependencyProvider); }
public ResourceTestContext(ResourceMode resourceMode = ResourceMode.Debug) { Mode = resourceMode; _finder = new StubResourceFinder(); _contentFilterPipelineMap = new ContentFilterPipelineMap(); _scriptGroups = new ResourceGroupManager(Mode); _styleGroups = new ResourceGroupManager(Mode); _dependencyCache = new InMemoryDependencyCache(); _dependencyProvider = new StubDependencyProvider(); _dependencyManager = new DependencyManager(_finder, _dependencyCache, _scriptGroups, _styleGroups); _dependencyManager.MapProvider(".js", _dependencyProvider); _dependencyManager.MapProvider(".css", _dependencyProvider); }
public void DependencyWishList_Resolved() { var cache = new InMemoryDependencyCache(); cache.Add(ModuleWith("A", "1.0")); cache.Add(ModuleWith("A", "1.1")); cache.Add(ModuleWith("A", "1.3")); cache.Add(ModuleWith("A", "2.0")); var wish = WishWith("A", "[1.1,2.0)"); var set = new ResolverWishSet(WishWith("A", "1.3"), cache); set.AddIfNotExists(WishWith("A", "1.3")); Assert.IsTrue(set.IsFixed(), "expect resolved as only one matching dep"); Assert.IsTrue(set.CanMatch(), "expect can match"); }
public void DependencyWishlist_HasNoMatches() { var cache = new InMemoryDependencyCache(); cache.Add(ModuleWith("A", "1.0")); cache.Add(ModuleWith("A", "1.1")); cache.Add(ModuleWith("A", "1.3")); cache.Add(ModuleWith("A", "2.0")); var wish = WishWith("A", "[1.1,2.0)"); var set = new ResolverWishSet(wish, cache); set.AddIfNotExists(WishWith("A", "(3.0]")); Assert.IsFalse(set.IsFixed(), "expect not resolved as no matching deps"); Assert.IsFalse(set.CanMatch(), "expect no possible matches"); }