本文整理汇总了C#中BehaviorSubject.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# BehaviorSubject.Dispose方法的具体用法?C# BehaviorSubject.Dispose怎么用?C# BehaviorSubject.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BehaviorSubject
的用法示例。
在下文中一共展示了BehaviorSubject.Dispose方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Value_ThrowsOnDispose
public void Value_ThrowsOnDispose()
{
var s = new BehaviorSubject<int>(42);
Assert.AreEqual(42, s.Value);
s.Dispose();
Assert.Fail("Should not be able to read Value: {0}", s.Value);
}
示例2: HasObservers_Dispose3
public void HasObservers_Dispose3()
{
var s = new BehaviorSubject<int>(42);
Assert.IsFalse(s.HasObservers);
s.Dispose();
Assert.IsFalse(s.HasObservers);
}
示例3: Value_ThrowsOnDispose
public void Value_ThrowsOnDispose()
{
var s = new BehaviorSubject<int>(42);
Assert.AreEqual(42, s.Value);
s.Dispose();
ReactiveAssert.Throws<ObjectDisposedException>(() =>
{
var ignored = s.Value;
});
var x = default(int);
Assert.IsFalse(s.TryGetValue(out x));
}
示例4: HasObservers_Dispose2
public void HasObservers_Dispose2()
{
var s = new BehaviorSubject<int>(42);
Assert.IsFalse(s.HasObservers);
var d = s.Subscribe(_ => { });
Assert.IsTrue(s.HasObservers);
d.Dispose();
Assert.IsFalse(s.HasObservers);
s.Dispose();
Assert.IsFalse(s.HasObservers);
}
示例5: WaitTriggerAsync
/// <summary>
/// トリガーにかかるか例外が出るまで待つ
/// </summary>
/// <param name="bs"></param>
/// <param name="trigger"></param>
/// <param name="status"></param>
/// <returns></returns>
private async Task WaitTriggerAsync(BehaviorSubject<bool> bs, IDisposable trigger, StatusItem status)
{
await this.SendLineAsync(null);
this.StatusSubject.OnNext(status);
var waiting = await bs
.Where(x => x)
.Select(x => new WaitResultContainer(null))
.Merge(this.ExceptionObservable)
.Take(1);
trigger.Dispose();
bs.Dispose();
if (!waiting.IsSucceeded)
{
throw waiting.Exception;
}
await this.WaitIfPausingAsync();
}