コード例 #1
0
        public void ShowWorker_OperationCompleleCallBackNotMade_CancelButtonTextIsNotSetToFinish()
        {
            FeedbackData data = new FeedbackData();
            var link = MockRepository.GenerateMock<ILinkerService>();
            link.Stub(l => l.GetStatusData(Arg<Dispatcher>.Is.Anything)).Return(data);
            link.Stub(l => l.OperationComplete = null).PropertyBehavior();

            var view = MockRepository.GenerateMock<IWorkingView>();

            var controller = new WorkerController(link, view);
            controller.ShowWorker(null);

            view.AssertWasNotCalled(v => v.CancelButtonText = "Finish");
        }
コード例 #2
0
        public void ShowWorker_CancelIsPressedWhenViewIsShown_LinkerServiceIsRequestedToCancel()
        {
            FeedbackData data = new FeedbackData();
            var link = MockRepository.GenerateMock<ILinkerService>();
            link.Stub(l => l.GetStatusData(Arg<Dispatcher>.Is.Anything)).Return(data);

            var view = MockRepository.GenerateMock<IWorkingView>();
            view.Stub(v => v.Show(Arg<IWin32Window>.Is.Anything))
                                                    .Do((Action<IWin32Window>)delegate(IWin32Window owner)
                                                    {
                                                        view.GetEventRaiser(v => v.CancelPress += null).Raise(null, null);
                                                    });

            var controller = new WorkerController(link, view);
            controller.ShowWorker(null);

            link.AssertWasCalled(l => l.CancelOperation());
        }
コード例 #3
0
        public void ShowWorker_OperationIsCompleleCancelButtonPressed_NoCancelIsCalledOnServiceViewIsClosed()
        {
            FeedbackData data = new FeedbackData();
            var link = MockRepository.GenerateMock<ILinkerService>();
            link.Stub(l => l.GetStatusData(Arg<Dispatcher>.Is.Anything)).Return(data);
            link.Stub(l => l.OperationComplete = null).PropertyBehavior();
            link.Stub(l => l.PerformOperation())
             .Do((Action)delegate
             {
                 link.OperationComplete();
             });

            var view = MockRepository.GenerateMock<IWorkingView>();

            var controller = new WorkerController(link, view);
            controller.ShowWorker(null);

            view.GetEventRaiser(v => v.CancelPress += null).Raise(null, null);

            link.AssertWasNotCalled(l => l.CancelOperation());
            view.AssertWasCalled(v => v.Close());
        }
コード例 #4
0
        public void ShowWorker_ViewIsShown_CancelButtonTextIsSetToCancel()
        {
            FeedbackData data = new FeedbackData();
            var link = MockRepository.GenerateMock<ILinkerService>();
            link.Stub(l => l.GetStatusData(Arg<Dispatcher>.Is.Anything)).Return(data);

            var view = MockRepository.GenerateMock<IWorkingView>();

            var controller = new WorkerController(link, view);
            controller.ShowWorker(null);

            view.AssertWasCalled(v => v.CancelButtonText = "Cancel");
        }
コード例 #5
0
        public void ShowWorker_ValidView_ViewIsShown()
        {
            FeedbackData data = new FeedbackData();
            var link = MockRepository.GenerateMock<ILinkerService>();
            link.Stub(l => l.GetStatusData(Arg<Dispatcher>.Is.Anything)).Return(data);

            var view = MockRepository.GenerateMock<IWorkingView>();

            var workerController = new WorkerController(link, view);

            workerController.ShowWorker(null);

            view.AssertWasCalled(v => v.Show(Arg<IWin32Window>.Is.Anything));
        }
コード例 #6
0
        public void ShowWorker_ValidLinkService_LinkOperationIsStarted()
        {
            FeedbackData data = new FeedbackData();
            var link = MockRepository.GenerateMock<ILinkerService>();
            link.Stub(l => l.GetStatusData(Arg<Dispatcher>.Is.Anything)).Return(data);

            var view = MockRepository.GenerateMock<IWorkingView>();

            var workerController = new WorkerController(link, view);

            workerController.ShowWorker(null);

            link.AssertWasCalled(l => l.PerformOperation());
        }
コード例 #7
0
        public void ShowWorker_ValidLinkService_DispatcherIsSet()
        {
            var link = MockRepository.GenerateMock<ILinkerService>();
            var view = MockRepository.GenerateMock<IWorkingView>();

            var workerController = new WorkerController(link, view);

            workerController.ShowWorker(null);

            link.AssertWasCalled(l => l.GetStatusData(Arg<Dispatcher>.Is.NotNull));
        }