コード例 #1
0
        public void Test_Apply_TestCase()
        {
            Tuple <Stream <int>, Dictionary <int, Action> > s1T = MkStream(new Dictionary <int, int> {
                { 1, 200 }, { 2, 300 }, { 4, 400 }
            });
            Stream <int>             s1  = s1T.Item1;
            Dictionary <int, Action> s1F = s1T.Item2;
            DiscreteCell <int>       ca  = s1.Hold(100);
            Tuple <Stream <Func <int, int> >, Dictionary <int, Action> > s2T = MkStream(new Dictionary <int, Func <int, int> > {
                { 1, x => x + 5 }, { 3, x => x + 6 }
            });
            Stream <Func <int, int> >       s2  = s2T.Item1;
            Dictionary <int, Action>        s2F = s2T.Item2;
            DiscreteCell <Func <int, int> > cf  = s2.Hold(x => x + 0);
            List <int> @out = RunSimulation <int>(ca.Apply(cf).Listen, new[] { s1F, s2F });

            CollectionAssert.AreEqual(new[] { 100, 205, 305, 306, 406 }, @out);
        }