예제 #1
0
        public void Map_Dispatches_To_Transformer_Objects()
        {
            var             listXf = new _ListXF();
            object          res    = R.Map(add1, listXf);
            DynamicDelegate f      = (DynamicDelegate)res.Member("f", @private: true);
            object          xf     = res.Member("xf", @private: true);

            Assert.IsInstanceOfType(res, typeof(XMap));
            Assert.AreEqual(xf, listXf);
            Assert.AreEqual(f.Unwrap(), add1);
        }
예제 #2
0
        public void Map_Can_Compose_Transducer_Style()
        {
            var             listXf   = new _ListXF();
            var             mdouble  = R.Map(times2);
            var             mdec     = R.Map(dec);
            var             xcomp    = mdec(mdouble(listXf));
            object          objxcomp = xcomp;
            var             xmap     = objxcomp.Member("xf", @private: true);
            DynamicDelegate f        = (DynamicDelegate)objxcomp.Member("f", @private: true);
            DynamicDelegate xmapf    = (DynamicDelegate)xmap.Member("f", @private: true);
            object          xmapXf   = xmap.Member("xf", @private: true);

            Assert.IsInstanceOfType(xcomp, typeof(XMap));
            Assert.IsInstanceOfType(xmap, typeof(XMap));
            Assert.AreEqual(xmapXf, listXf);
            Assert.AreEqual(xmapf.Unwrap(), times2);
            Assert.AreEqual(f.Unwrap(), dec);
        }