public void ShouldAddDetailsViewAndControlsViewToContentArea()
        {
            var detailsViewModel = new MockOrderDetailsViewModel();

            var composite = new OrderCompositeViewModel(detailsViewModel);

            Assert.AreSame(detailsViewModel, composite.OrderDetails);
        }
        public void ShouldCreateOrderdetailsViewModel()
        {
            var detailsViewModel = new MockOrderDetailsViewModel();

            var composite = new OrderCompositeViewModel(detailsViewModel);

            composite.TransactionInfo = new TransactionInfo("FXX01", TransactionType.Sell);

            Assert.IsNotNull(detailsViewModel.TransactionInfo);
        }
        public void TransactionInfoAndSharesAndCommandsAreTakenFromOrderDetails()
        {
            var orderDetailsPM = new MockOrderDetailsViewModel();
            var composite = new OrderCompositeViewModel(orderDetailsPM);
            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 PresenterExposesChildOrderPresentersCloseRequested()
        {
            var detailsViewModel = new MockOrderDetailsViewModel();

            var composite = new OrderCompositeViewModel(detailsViewModel);

            var closeViewRequestedFired = false;
            composite.CloseViewRequested += delegate
                                                {
                                                    closeViewRequestedFired = true;
                                                };

            detailsViewModel.RaiseCloseViewRequested();

            Assert.IsTrue(closeViewRequestedFired);

        }
        public void ShouldUpdateHeaderInfoWhenUpdatingTransactionInfo()
        {
            var orderDetailsPM = new MockOrderDetailsViewModel();
            var composite = new OrderCompositeViewModel(orderDetailsPM);

            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);
        }