public void ShouldPassModelToView() { var view = new MockOrderCompositeView(); var composite = new OrderCompositePresentationModel(view, new MockOrderDetailsPresentationModel(), new OrderCommandsView()); composite.TransactionInfo = new TransactionInfo("FXX01", TransactionType.Sell); Assert.IsNotNull(view); Assert.AreEqual(composite, view.Model); }
public void ShouldAddDetailsViewAndControlsViewToContentArea() { MockOrderCompositeView compositeView = new MockOrderCompositeView(); var detailsPresenter = new MockOrderDetailsPresentationModel(); var composite = new OrderCompositePresentationModel(compositeView, detailsPresenter, new OrderCommandsView()); Assert.AreEqual(detailsPresenter.View, composite.OrderDetailsView); Assert.IsNotNull(composite.OrderCommandsView as OrderCommandsView); }
public void ShouldCreateOrderDetailsPresenter() { var detailsPresenter = new MockOrderDetailsPresentationModel(); IOrderCompositeView compositeView = new MockOrderCompositeView(); var composite = new OrderCompositePresentationModel(compositeView, detailsPresenter, new OrderCommandsView()); composite.TransactionInfo = new TransactionInfo("FXX01", TransactionType.Sell); Assert.IsNotNull(detailsPresenter.TransactionInfo); }
public void ShouldSetHeaderInfo() { var composite = new OrderCompositePresentationModel(new MockOrderCompositeView(), new MockOrderDetailsPresentationModel(), new OrderCommandsView()); composite.TransactionInfo = new TransactionInfo("FXX01", TransactionType.Sell); Assert.IsNotNull(composite.HeaderInfo); Assert.IsTrue(composite.HeaderInfo.Contains("FXX01")); Assert.IsTrue(composite.HeaderInfo.Contains("Sell")); Assert.AreEqual("Sell FXX01", composite.HeaderInfo); }
public void TransactionInfoAndSharesAndCommandsAreTakenFromOrderDetails() { var orderDetailsPM = new MockOrderDetailsPresentationModel(); var composite = new OrderCompositePresentationModel(new MockOrderCompositeView(), orderDetailsPM, new OrderCommandsView()); orderDetailsPM.Shares = 100; Assert.AreEqual(orderDetailsPM.Shares, composite.Shares); Assert.AreSame(orderDetailsPM.SubmitCommand, composite.SubmitCommand); Assert.AreSame(orderDetailsPM.CancelCommand, composite.CancelCommand); Assert.AreSame(orderDetailsPM.TransactionInfo, composite.TransactionInfo); }
public void ShouldDelegateIsActivePropertyChangesToDetailView() { var detailsPresenter = new MockOrderDetailsPresentationModel(); MockOrderCompositeView compositeView = new MockOrderCompositeView(); var composite = new OrderCompositePresentationModel(compositeView, detailsPresenter, new OrderCommandsView()); compositeView.IsActive = false; Assert.IsFalse(detailsPresenter.View.IsActive); compositeView.IsActive = true; Assert.IsTrue(detailsPresenter.View.IsActive); }
public void ShouldUpdateHeaderInfoWhenUpdatingTransactionInfo() { var orderDetailsPM = new MockOrderDetailsPresentationModel(); var composite = new OrderCompositePresentationModel(new MockOrderCompositeView(), orderDetailsPM, new OrderCommandsView()); composite.TransactionInfo = new TransactionInfo("FXX01", TransactionType.Sell); orderDetailsPM.TransactionInfo.TickerSymbol = "NEW_SYMBOL"; Assert.AreEqual("Sell NEW_SYMBOL", composite.HeaderInfo); orderDetailsPM.TransactionInfo.TransactionType = TransactionType.Buy; Assert.AreEqual("Buy NEW_SYMBOL", composite.HeaderInfo); }
public void PresenterExposesChildOrderPresentersCloseRequested() { var detailsPresenter = new MockOrderDetailsPresentationModel(); MockOrderCompositeView compositeView = new MockOrderCompositeView(); var composite = new OrderCompositePresentationModel(compositeView, detailsPresenter, new OrderCommandsView()); var closeViewRequestedFired = false; composite.CloseViewRequested += delegate { closeViewRequestedFired = true; }; detailsPresenter.RaiseCloseViewRequested(); Assert.IsTrue(closeViewRequestedFired); }