public void UpdateStatus_Fires_StatusChanged_Event_If_Status_Changes() { //Arrange var helper = new HelperForSimpleFx(); _fx = new SimpleFxBaseTestClass(Guid.NewGuid()); _fx.StatusChanged += new FxStatusChangeEventHandler<ISimpleFx, FxStatusChangeEventArgs>(helper.StatusChanged_DummyHandler); //Act _fx.UpdateStatus(FxStatus.Complete, StatusChangeDriver.NormalTransition, null); //Assert Assert.Equal(1, helper.StatusChanged_TimesCalled); Assert.NotNull(helper.RecievedEventArgs); }
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); }
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)); }
public void UpdateStatus_FiresStatusChangedEventAfterFxStatusChanges() { HelperForSimpleFx helper = new HelperForSimpleFx(); _fx.StatusChanged += new FxStatusChangeEventHandler<ISimpleFx, FxStatusChangeEventArgs>(helper.StatusChanged_DummyHandler); using (RecordExpectations recorder = RecorderManager.StartRecording()) { helper.StatusChanged_DummyHandler(null, null); } _fx.UpdateStatus(FxStatus.Complete, StatusChangeDriver.NormalTransition, null); MockManager.Verify(); }
public void UpdateStatus_DoesNotFireStatusChangedEventIfStatusValueAssignedTheSameValue() { FxStatus newStatus = _fx.Status; HelperForSimpleFx helper = new HelperForSimpleFx(); _fx.StatusChanged += new FxStatusChangeEventHandler<ISimpleFx, FxStatusChangeEventArgs>(helper.StatusChanged_DummyHandler); using (RecordExpectations recorder = RecorderManager.StartRecording()) { helper.StatusChanged_DummyHandler(null, null); recorder.FailWhenCalled(); } _fx.UpdateStatus(newStatus, StatusChangeDriver.NormalTransition, null); MockManager.Verify(); }
public void StatusUpdate_DoesNothingIfStatusDoesNotChange() { _fx.Status = FxStatus.Executing; HelperForSimpleFx helper = new HelperForSimpleFx(); _fx.StatusChanged += new FxStatusChangeEventHandler<ISimpleFx, FxStatusChangeEventArgs>(helper.StatusChanged_DummyHandler); using (RecordExpectations recorder = RecorderManager.StartRecording()) { helper.StatusChanged_DummyHandler(null, null); recorder.FailWhenCalled(); } _fx.UpdateStatus(FxStatus.Executing, StatusChangeDriver.NormalTransition, null); MockManager.Verify(); }