本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}