Ejemplo n.º 1
0
        public void ExecComplete_When_WorkerStatus_Is_Uninitialized()
        {
            //Arrange
            _fx = new SimpleFxBaseTestClass(Guid.NewGuid());
            _fx.CompletionCalled = false;
            _fx.WorkerStatus = FxWorkerStatus.Uninitialized;

            var helper = new HelperForSimpleFx();
            _fx.ExecuteCompleted += new FxCompletedEventHandler<ISimpleFx, FxCompletedEventArgs>(helper.ExecuteCompleted_DummyHandler);

            Exception ex = null;
            string mssg = null;
            bool isCancelled = false;
            int progAtCompletion = 100;

            //Act
            _fx.ExecComplete(progAtCompletion, isCancelled, ex, mssg);

            //Assert
            Assert.Equal(1, helper.ExecuteCompleted_TimesCalled);
            Assert.NotNull(helper.RecievedEventArgs);
            Assert.Null(_fx.AsynchOp);
        }
Ejemplo n.º 2
0
        public void ExecComplete_Throws_Ex_When_WorkerStatus_Is_ExecutingSynch()
        {
            //Arrange
            _fx = new SimpleFxBaseTestClass(Guid.NewGuid());
            _fx.CompletionCalled = false;
            _fx.WorkerStatus = FxWorkerStatus.ExecutingSynch;

            var helper = new HelperForSimpleFx();
            _fx.ExecuteCompleted += new FxCompletedEventHandler<ISimpleFx, FxCompletedEventArgs>(helper.ExecuteCompleted_DummyHandler);

            Exception ex = null;
            string mssg = null;
            bool isCancelled = false;
            int progAtCompletion = 100;

            //Act, Assert
            var x2 = Assert.Throws<InvalidOperationException>(() => _fx.ExecComplete(progAtCompletion, isCancelled, ex, mssg));
        }