Ejemplo n.º 1
0
        public void SetUp()
        {
            stats = new StatsObserver <string>();

            left  = new StatsSubject <int>();
            right = new StatsSubject <int>();

            leftWindows  = new List <StatsSubject <Unit> >();
            rightWindows = new List <StatsSubject <Unit> >();

            leftValueAction = rightValueAction = () => { };

            combineAction = (l, r) => String.Format("{0},{1}", l, r);

            subscription = left.Join(right,
                                     leftVal =>
            {
                leftValueAction();
                var leftWindow = new StatsSubject <Unit>();
                leftWindows.Add(leftWindow);
                return(leftWindow);
            },
                                     rightVal =>
            {
                rightValueAction();
                var rightWindow = new StatsSubject <Unit>();
                rightWindows.Add(rightWindow);
                return(rightWindow);
            },
                                     (l, r) => combineAction(l, r)
                                     )
                           .Subscribe(stats);
        }
Ejemplo n.º 2
0
        public void SetUp()
        {
            stats = new StatsObserver<string>();

            left = new StatsSubject<int>();
            right = new StatsSubject<int>();

            leftWindows = new List<StatsSubject<Unit>>();
            rightWindows = new List<StatsSubject<Unit>>();

            leftValueAction = rightValueAction = () => { };

            combineAction = (l, r) => String.Format("{0},{1}", l, r);

            subscription = left.Join(right,
                leftVal =>
                    {
                        leftValueAction();
                        var leftWindow = new StatsSubject<Unit>();
                        leftWindows.Add(leftWindow);
                        return leftWindow;
                    },
                rightVal =>
                    {
                        rightValueAction();
                        var rightWindow = new StatsSubject<Unit>();
                        rightWindows.Add(rightWindow);
                        return rightWindow;
                    },
                (l, r) => combineAction(l,r)
                )
                .Subscribe(stats);
        }