コード例 #1
0
ファイル: Transaction.cs プロジェクト: adchang/demo_exchange
 public Transaction(OrderBL buyOrder, OrderBL sellOrder, string ticker, int quantity,
                    decimal price)
 {
     // TODO: Precondtions
     base.TransactionId    = Guid.NewGuid();
     base.CreatedTimestamp = Now;
     base.BuyOrder         = buyOrder;
     base.SellOrder        = sellOrder;
     base.Ticker           = ticker;
     base.Quantity         = quantity;
     base.Price            = price;
 }
コード例 #2
0
        public void CancelTest()
        {
            Guid    orderId = Guid.NewGuid();
            OrderBL order   = new TestOrder {
                OrderId = orderId.ToString(),
                Status  = OrderStatus.OrderCompleted
            };
            Exception e = Assert.Throws <ArgumentException>(() =>
                                                            order.Cancel());

            Assert.Equal("Error Cancel: Status is not Open OrderId: " + orderId.ToString(),
                         e.Message);
            OrderBL open = TestUtils.NewBuyLimitDayOrder();

            Assert.Equal(0, open.CanceledTimestamp);
            open.Cancel();
            Assert.Equal(OrderStatus.OrderCancelled, open.Status);
            Assert.NotEqual(0, open.CanceledTimestamp);
        }