public void cancel_raises_property_changed_for_is_cancelled() { var sut = new ExecutionContext(); var called = false; sut.ObservableForProperty(x => x.IsCancelled) .Subscribe(_ => called = true); Assert.False(called); sut.Cancel(); Assert.True(called); }
public void execute_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.Execute(context).Subscribe(); 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]); }
public void execute_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.Execute(context).Subscribe(); Assert.Equal(3, currentSets.Count); Assert.Equal(1, currentSets[0]); Assert.Equal(2, currentSets[1]); Assert.Equal(3, currentSets[2]); }