public void OnNewButtonClick_throws_exception_with_null_View()
 {
     //arrange
     var orderFactory = MockRepository.GenerateStub<IOrderFactory>();
     var dataBinder = MockRepository.GenerateStub<IOrderListDataBinder>();
     var viewFactory = MockRepository.GenerateStub<IViewFactory>();
     var target = new OrderListPresenter(orderFactory, dataBinder, viewFactory);
     //act, assert
     target.OnNewButtonClick();
 }
 public void OnNewButtonClick_creates_new_order_from_business_layer_and_opens_order_edit_view_and_binds_UI()
 {
     //arrange
     var orderFactory = MockRepository.GenerateMock<IOrderFactory>();
     var dataBinder = MockRepository.GenerateMock<IOrderListDataBinder>();
     var viewFactory = MockRepository.GenerateMock<IViewFactory>();
     var view = MockRepository.GenerateStub<IOrderListView>();
     var order = MockRepository.GenerateStub<IOrder>();
     var editView = MockRepository.GenerateMock<IOrderEditView>();
     var target = new OrderListPresenter(orderFactory, dataBinder, viewFactory);
     target.View = view;
     orderFactory.Expect(x => x.Create())
         .Return(order);
     viewFactory.Expect(x => x.CreateOrderEditView(order))
         .Return(editView);
     editView.Expect(x => x.Show());
     dataBinder.Expect(x => x.BindUI(target));
     //act
     target.OnNewButtonClick();
     //assert
     orderFactory.VerifyAllExpectations();
     viewFactory.VerifyAllExpectations();
     editView.VerifyAllExpectations();
     dataBinder.VerifyAllExpectations();
 }