public void PropertyChangedIsRaisedWhenSharesIsChanged() { var viewModel = new OrderDetailsViewModel(null, null); viewModel.Shares = 5; bool sharesPropertyChangedRaised = false; viewModel.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "Shares") sharesPropertyChangedRaised = true; }; viewModel.Shares = 1; Assert.IsTrue(sharesPropertyChangedRaised); }
public void SubmitCallsServiceWithCorrectOrder() { var ordersService = new MockOrdersService(); var viewModel = new OrderDetailsViewModel(new MockAccountPositionService(), ordersService); viewModel.Shares = 2; viewModel.TickerSymbol = "AAAA"; viewModel.TransactionType = TransactionType.Buy; viewModel.TimeInForce = TimeInForce.EndOfDay; viewModel.OrderType = OrderType.Limit; viewModel.StopLimitPrice = 15; Assert.IsNull(ordersService.SubmitArgumentOrder); viewModel.SubmitCommand.Execute(null); var submittedOrder = ordersService.SubmitArgumentOrder; Assert.IsNotNull(submittedOrder); Assert.AreEqual("AAAA", submittedOrder.TickerSymbol); Assert.AreEqual(TransactionType.Buy, submittedOrder.TransactionType); Assert.AreEqual(TimeInForce.EndOfDay, submittedOrder.TimeInForce); Assert.AreEqual(OrderType.Limit, submittedOrder.OrderType); Assert.AreEqual(15, submittedOrder.StopLimitPrice); }
public void VerifyTransactionInfoModificationsInOrderDetails() { var orderDetailsViewModel = new OrderDetailsViewModel(new MockAccountPositionService(), null); var transactionInfo = new TransactionInfo { TickerSymbol = "Fund0", TransactionType = TransactionType.Buy }; orderDetailsViewModel.TransactionInfo = transactionInfo; orderDetailsViewModel.TransactionType = TransactionType.Sell; Assert.AreEqual(TransactionType.Sell, transactionInfo.TransactionType); orderDetailsViewModel.TickerSymbol = "Fund1"; Assert.AreEqual("Fund1", transactionInfo.TickerSymbol); }
public void SetTransactionInfoShouldUpdateTheModel() { var viewModel = new OrderDetailsViewModel(new MockAccountPositionService(), null); viewModel.TransactionInfo = new TransactionInfo { TickerSymbol = "T000", TransactionType = TransactionType.Sell }; Assert.AreEqual("T000", viewModel.TickerSymbol); Assert.AreEqual(TransactionType.Sell, viewModel.TransactionType); }
public void ViewModelCreatesCallSetTimeInForce() { var viewModel = new OrderDetailsViewModel(null, null); Assert.IsNotNull(viewModel.AvailableTimesInForce); Assert.IsTrue(viewModel.AvailableTimesInForce.Count > 0); Assert.AreEqual(GetEnumCount(typeof(TimeInForce)), viewModel.AvailableTimesInForce.Count); }
public void ViewModelCreatesCallSetOrderTypes() { var viewModel = new OrderDetailsViewModel(null, null); Assert.IsNotNull(viewModel.AvailableOrderTypes); Assert.IsTrue(viewModel.AvailableOrderTypes.Count > 0); Assert.AreEqual(GetEnumCount(typeof(OrderType)), viewModel.AvailableOrderTypes.Count); }
public void PresenterCreatesCallSetTimeInForce() { var presenter = new OrderDetailsViewModel(null, null); Assert.IsNotNull(presenter.AvailableTimesInForce); Assert.IsTrue(presenter.AvailableTimesInForce.Count > 0); Assert.AreEqual(GetEnumCount(typeof(TimeInForce)), presenter.AvailableTimesInForce.Count); }
public void PresenterCreatesCallSetOrderTypes() { var presenter = new OrderDetailsViewModel(null, null); Assert.IsNotNull(presenter.AvailableOrderTypes); Assert.IsTrue(presenter.AvailableOrderTypes.Count > 0); Assert.AreEqual(GetEnumCount(typeof(OrderType)), presenter.AvailableOrderTypes.Count); }