public async Task OnCompleted_CompletedTest()
        {
            Task         taskToObserve = Task.Run(() => { Task.Delay(2000).Wait(); });
            TaskObserver observer      = TaskObserver.Create(taskToObserve, GetLogger());

            observer.OnNext(taskToObserve);
            observer.OnCompleted();
            bool completedTransition = await observer.TaskStatusCompletedTransition;

            Assert.IsTrue(completedTransition);
        }
Example #2
0
        public void SubscribeTest()
        {
            List <Task> tasks = new List <Task>();
            Task        task  = Task.Run(() => { });

            tasks.Add(task);
            TasksProvider provider = TasksProvider.Create(new List <Task>(), GetLogger());

            provider.AddTask(task);
            TaskObserver observer = TaskObserver.Create(task, GetLogger());

            observer.OnNext(task);
            IDisposable unsubscriber = provider.Subscribe(observer);

            Assert.IsTrue(provider.Subscribe(observer) is IDisposable);
        }