本文整理汇总了C#中ExecutionContext.ObservableForProperty方法的典型用法代码示例。如果您正苦于以下问题:C# ExecutionContext.ObservableForProperty方法的具体用法?C# ExecutionContext.ObservableForProperty怎么用?C# ExecutionContext.ObservableForProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExecutionContext
的用法示例。
在下文中一共展示了ExecutionContext.ObservableForProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: execute_async_updates_the_current_repetitions_in_the_context
public void execute_async_updates_the_current_repetitions_in_the_context()
{
var sut = new ExerciseBuilder()
.WithRepetitionCount(5)
.Build();
var context = new ExecutionContext();
var currentRepetitions = context
.ObservableForProperty(x => x.CurrentRepetition)
.Select(x => x.Value)
.CreateCollection();
sut.ExecuteAsync(context);
Assert.Equal(5, currentRepetitions.Count);
Assert.Equal(1, currentRepetitions[0]);
Assert.Equal(2, currentRepetitions[1]);
Assert.Equal(3, currentRepetitions[2]);
Assert.Equal(4, currentRepetitions[3]);
Assert.Equal(5, currentRepetitions[4]);
}
示例2: execute_async_updates_the_current_set_in_the_context
public void execute_async_updates_the_current_set_in_the_context()
{
var sut = new ExerciseBuilder()
.WithSetCount(3)
.Build();
var context = new ExecutionContext();
var currentSets = context
.ObservableForProperty(x => x.CurrentSet)
.Select(x => x.Value)
.CreateCollection();
sut.ExecuteAsync(context);
Assert.Equal(3, currentSets.Count);
Assert.Equal(1, currentSets[0]);
Assert.Equal(2, currentSets[1]);
Assert.Equal(3, currentSets[2]);
}