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"); }
public ResolverWishSet LocalWishSetFor(Wish wish) { var key = wish.Key; //already added our filter if (m_localModifiedKeys.Contains(key)) { return m_wishSetsByKey[key]; } m_localModifiedKeys.Add(key); ResolverWishSet existingWishes; if (m_wishSetsByKey.TryGetValue(key, out existingWishes)) { //if we already have a wishlist for this type then add another version constraint on to it var wrappingSet = new ResolverWishSet(wish, existingWishes); m_wishSetsByKey[key] = wrappingSet; Log.Trace("Wrapped existing wishset : " + existingWishes.ToSummary()); return wrappingSet; } else { //a new key and therefore wishlist var newSet = new ResolverWishSet(wish, m_cache); m_wishSetsByKey[key] = newSet; Log.Trace("Added new wishset : " + newSet.ToSummary()); return newSet; } }