Ejemplo n.º 1
0
        public void HistoryPresenter_NewQueryClick_Cancel_Test()
        {
            // Arrange
            var queryView = MockRepository.GenerateMock <IQueryView>();

            queryView.Expect(x => x.ShowDialog(_view)).Return(DialogResult.Cancel);
            _viewFactory.Expect(x => x.GetQueryDialog()).Return(queryView);
            // Act
            _presenter = CreatePresenter();
            _presenter.NewQueryClick();
            // Assert
            queryView.VerifyAllExpectations();
            _viewFactory.VerifyAllExpectations();
        }
Ejemplo n.º 2
0
        public void HistoryPresenter_NewQueryClick_Failed_Test()
        {
            // Arrange
            var queryView = MockRepository.GenerateMock <IQueryView>();

            queryView.Expect(x => x.ShowDialog(_view)).Return(DialogResult.OK).Repeat.Once();
            queryView.Stub(x => x.Query).Return(new QueryParameters());
            _viewFactory.Expect(x => x.GetQueryDialog()).Return(queryView);
            _messageBoxView.Expect(x => x.ShowError(_view, String.Empty, String.Empty)).IgnoreArguments();
            // Act
            _presenter = CreatePresenter();
            _presenter.NewQueryClick();
            // Assert
            queryView.VerifyAllExpectations();
            _viewFactory.VerifyAllExpectations();
            _messageBoxView.VerifyAllExpectations();
        }
Ejemplo n.º 3
0
        public void HistoryPresenter_NewQueryClick_Test()
        {
            // Arrange
            var queryView = MockRepository.GenerateMock <IQueryView>();

            queryView.Expect(x => x.ShowDialog(_view)).Return(DialogResult.OK);
            var parameters = new QueryParameters {
                Name = "Test"
            };

            parameters.Fields.Add(new QueryField {
                Value = 6606
            });
            queryView.Stub(x => x.Query).Return(parameters);
            _viewFactory.Expect(x => x.GetQueryDialog()).Return(queryView);
            // Act
            _presenter = CreatePresenter();
            _presenter.NewQueryClick();
            // Assert
            queryView.VerifyAllExpectations();
            _viewFactory.VerifyAllExpectations();
        }
Ejemplo n.º 4
0
 private void btnNew_Click(object sender, EventArgs e)
 {
     _presenter.NewQueryClick();
 }