Exemplo n.º 1
0
        public async void What_Is_The_Behavior_Of_Observable_FromEvent()
        {
            //Arrange
            var testTarget = new MyTest();
            //testTarget.TestStarted += HandleTestStarted;
            //testTarget.OnTestStart();

            var observableTarget =
                Observable.FromEventPattern(h => testTarget.TestStarted += h, h => testTarget.TestStarted -= h);
            IObserver <EventPattern <object> > testObserver = new TestObserver(HandleTestStarted);
            //observableTarget.Subscribe(testObserver);

            var   myTask = observableTarget.Timeout(TimeSpan.FromSeconds(1)).ToTask();
            await myTask;

            testTarget.OnTestStart();
        }