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