Ejemplo n.º 1
0
            public void CompletesWhenCreatedFromAsyncTask()
            {
                var testScheduler = new TestScheduler();

                async Task asyncFunction(int n)
                {
                    await Task.FromResult(default(Unit));
                }

                var action = InputAction <int> .FromAsync(asyncFunction, testScheduler);

                var observer = testScheduler.CreateObserver <Unit>();

                action.ExecuteWithCompletion(2).Subscribe(observer);
                testScheduler.Start();

                observer.Messages.Count.Should().Be(2);
                observer.Messages.Last().Value.Kind.Should().Be(NotificationKind.OnCompleted);
            }
Ejemplo n.º 2
0
 public InputAction <TInput> FromAsync <TInput>(Func <TInput, Task> asyncAction, IObservable <bool> enabledIf = null)
 {
     return(InputAction <TInput> .FromAsync(asyncAction, schedulerProvider.MainScheduler, enabledIf));
 }