本文整理匯總了C#中BehaviorSubject.TryGetValue方法的典型用法代碼示例。如果您正苦於以下問題:C# BehaviorSubject.TryGetValue方法的具體用法?C# BehaviorSubject.TryGetValue怎麽用?C# BehaviorSubject.TryGetValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BehaviorSubject
的用法示例。
在下文中一共展示了BehaviorSubject.TryGetValue方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: 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));
}
示例2: Value_ThrowsAfterOnError
public void Value_ThrowsAfterOnError()
{
var s = new BehaviorSubject<int>(42);
Assert.AreEqual(42, s.Value);
s.OnError(new InvalidOperationException());
ReactiveAssert.Throws<InvalidOperationException>(() =>
{
var ignored = s.Value;
});
ReactiveAssert.Throws<InvalidOperationException>(() =>
{
var x = default(int);
s.TryGetValue(out x);
});
}
示例3: Value_FrozenAfterOnCompleted
public void Value_FrozenAfterOnCompleted()
{
var s = new BehaviorSubject<int>(42);
Assert.AreEqual(42, s.Value);
var x = default(int);
Assert.IsTrue(s.TryGetValue(out x));
Assert.AreEqual(42, x);
s.OnNext(43);
Assert.AreEqual(43, s.Value);
Assert.IsTrue(s.TryGetValue(out x));
Assert.AreEqual(43, x);
s.OnNext(44);
Assert.AreEqual(44, s.Value);
Assert.IsTrue(s.TryGetValue(out x));
Assert.AreEqual(44, x);
s.OnCompleted();
Assert.AreEqual(44, s.Value);
Assert.IsTrue(s.TryGetValue(out x));
Assert.AreEqual(44, x);
s.OnNext(1234);
Assert.AreEqual(44, s.Value);
Assert.IsTrue(s.TryGetValue(out x));
Assert.AreEqual(44, x);
}
示例4: Value_Second
public void Value_Second()
{
var s = new BehaviorSubject<int>(42);
Assert.AreEqual(42, s.Value);
var x = default(int);
Assert.IsTrue(s.TryGetValue(out x));
Assert.AreEqual(42, x);
s.OnNext(43);
Assert.AreEqual(43, s.Value);
Assert.IsTrue(s.TryGetValue(out x));
Assert.AreEqual(43, x);
s.OnNext(44);
Assert.AreEqual(44, s.Value);
Assert.IsTrue(s.TryGetValue(out x));
Assert.AreEqual(44, x);
}
示例5: Value_Initial
public void Value_Initial()
{
var s = new BehaviorSubject<int>(42);
Assert.AreEqual(42, s.Value);
var x = default(int);
Assert.IsTrue(s.TryGetValue(out x));
Assert.AreEqual(42, x);
}
示例6: Value_First
public void Value_First()
{
var s = new BehaviorSubject<int>(42);
Assert.Equal(42, s.Value);
var x = default(int);
Assert.True(s.TryGetValue(out x));
Assert.Equal(42, x);
s.OnNext(43);
Assert.Equal(43, s.Value);
Assert.True(s.TryGetValue(out x));
Assert.Equal(43, x);
}