Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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)));
        }
Exemplo n.º 3
0
 public void Using_MultiMethod_Will_Add_To_DispatcherCache()
 {
     // Shape constructor: MultiMethod.Func<IShape, string>(this.Intersect)
     Assert.Greater(DispatcherCache.ForType(typeof(Circle)).Size, 0);
 }