当前位置: 首页>>代码示例>>C#>>正文


C# Subject.And方法代码示例

本文整理汇总了C#中Subject.And方法的典型用法代码示例。如果您正苦于以下问题:C# Subject.And方法的具体用法?C# Subject.And怎么用?C# Subject.And使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Subject的用法示例。


在下文中一共展示了Subject.And方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: matches_values_in_order_when_sent_out_of_order

        public void matches_values_in_order_when_sent_out_of_order()
        {
            var subjectA = new Subject<int>();
            var subjectB = new Subject<int>();

            var stats = new StatsObserver<string>();

            Observable.Join(
                subjectA.And(subjectB).Then((x, y) => String.Concat(x.ToString(), ",", y.ToString()))
                )
                .Subscribe(stats);

            subjectA.OnNext(0);
            subjectA.OnNext(1);
            subjectA.OnCompleted();

            subjectB.OnNext(10);
            subjectB.OnNext(11);
            subjectB.OnCompleted();

            Assert.AreEqual(2, stats.NextCount);
            Assert.AreEqual("0,10", stats.NextValues[0]);
            Assert.AreEqual("1,11", stats.NextValues[1]);
            Assert.IsTrue(stats.CompletedCalled);
        }
开发者ID:richardszalay,项目名称:raix,代码行数:25,代码来源:JoinsFixture.cs

示例2: unpartners_values_are_ignored

        public void unpartners_values_are_ignored()
        {
            var subjectA = new Subject<int>();
            var subjectB = new Subject<int>();

            var stats = new StatsObserver<string>();

            Observable.Join(
                subjectA.And(subjectB).Then((x, y) => String.Concat(x.ToString(), ",", y.ToString()))
                )
                .Subscribe(stats);

            subjectA.OnNext(0);
            subjectA.OnNext(1);
            subjectA.OnCompleted();

            subjectB.OnNext(10);
            subjectB.OnCompleted();

            Assert.AreEqual(1, stats.NextCount);
            Assert.AreEqual("0,10", stats.NextValues[0]);
            Assert.IsTrue(stats.CompletedCalled);
        }
开发者ID:richardszalay,项目名称:raix,代码行数:23,代码来源:JoinsFixture.cs

示例3: merges_multiple_joins_that_share_sources

        public void merges_multiple_joins_that_share_sources()
        {
            var subjectA = new Subject<int>();
            var subjectB = new Subject<int>();
            var subjectC = new Subject<int>();

            var stats = new StatsObserver<string>();

            Observable.Join(
                    subjectA.And(subjectB).Then((x, y) => String.Concat(x.ToString(), ",", y.ToString())),
                    subjectA.And(subjectC).Then((x, y) => String.Concat(x.ToString(), ",", y.ToString()))
                )
                .Subscribe(stats);

            subjectA.OnNext(0);
            subjectB.OnNext(1);

            subjectA.OnNext(0);
            subjectC.OnNext(2);

            Assert.AreEqual(0, stats.NextCount);
        }
开发者ID:richardszalay,项目名称:raix,代码行数:22,代码来源:JoinsFixture.cs

示例4: raises_error_when_subscription_is_repeated_within_pattern

        public void raises_error_when_subscription_is_repeated_within_pattern()
        {
            var subjectA = new Subject<int>();

            var stats = new StatsObserver<string>();

            Observable.Join(
                subjectA.And(subjectA).Then((x, y) => (string)null)
                )
                .Subscribe(stats);

            Assert.IsTrue(stats.ErrorCalled);
            Assert.IsTrue(stats.Error is ArgumentException);
        }
开发者ID:richardszalay,项目名称:raix,代码行数:14,代码来源:JoinsFixture.cs

示例5: XAndYOrZ

        public bool XAndYOrZ(bool x, bool y, bool z)
        {
            bool? result = null;

            var xObservable = new Subject<bool>();
            var yObservable = new Subject<bool>();
            var zObservable = new Subject<bool>();

            var combined = xObservable.And(yObservable).Or(zObservable);
            combined.Subscribe(c => result = c);

            zObservable.OnNext(z);
            xObservable.OnNext(x);
            yObservable.OnNext(y);

            return result.Value;
        }
开发者ID:TheAngryByrd,项目名称:ReactiveOperators,代码行数:17,代码来源:ReactiveBooleanOperatorsTests.cs


注:本文中的Subject.And方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。