public void Can_Get_Cached_Dispatcher_By_Method() { Dispatcher d1 = Dispatcher.For(typeof(A), m1); Dispatcher d2 = Dispatcher.For(typeof(A), m2); Assert.AreNotSame(d1, d2); Assert.AreSame(d1, DispatcherCache.ForType(typeof(A)).DispatcherFor(m1)); Assert.AreSame(d2, DispatcherCache.ForType(typeof(A)).DispatcherFor(m2)); }
public void Can_Get_Cache_For_Type() { DispatcherCache a = DispatcherCache.ForType(typeof(A)); DispatcherCache b = DispatcherCache.ForType(typeof(B)); Assert.IsNotNull(a); Assert.IsNotNull(b); Assert.AreSame(a, DispatcherCache.ForType(typeof(A))); Assert.AreSame(b, DispatcherCache.ForType(typeof(B))); }
public void Using_MultiMethod_Will_Add_To_DispatcherCache() { // Shape constructor: MultiMethod.Func<IShape, string>(this.Intersect) Assert.Greater(DispatcherCache.ForType(typeof(Circle)).Size, 0); }