Exemple #1
0
 internal FakeOrder(FakeTransaction tran, Guid id, string code, decimal lot, decimal lotBalance, OperationType type = OperationType.None)
     : base("Order", 5)
 {
     tran.AddOrder(this, type);
     _id         = BusinessItemFactory.Create("Id", id, PermissionFeature.Key, this);
     _code       = BusinessItemFactory.Create("Code", code, PermissionFeature.ReadOnly, this);
     _lot        = BusinessItemFactory.Create("Lot", lot, PermissionFeature.ReadOnly, this);
     _lotBalance = BusinessItemFactory.Create("LotBalance", lotBalance, PermissionFeature.Sound, this);
     _phase      = BusinessItemFactory.Create("Phase", OrderPhase.Placed, PermissionFeature.Sound, this);
 }
Exemple #2
0
        public void RejectTestWithAsNewRecord()
        {
            FakeAccount account = new FakeAccount(Guid.NewGuid(), "Acc4");

            Debug.WriteLine(account.SaveChanges());
            Assert.AreEqual(0, account.TransactionCount);
            FakeTransaction tran1  = new FakeTransaction(Guid.NewGuid(), "tran1", account, OperationType.AsNewRecord);
            FakeOrder       order1 = new FakeOrder(tran1, Guid.NewGuid(), "order1", 2, 2);

            account.RejectChanges();
            Assert.AreEqual(0, account.TransactionCount);
        }
Exemple #3
0
        public void PlaceTest()
        {
            FakeAccount     account  = new FakeAccount(Guid.NewGuid(), "Acc1");
            Guid            tran1_id = Guid.NewGuid();
            FakeTransaction tran1    = new FakeTransaction(tran1_id, "tran1", account, OperationType.AsNewRecord);

            Assert.AreEqual(ChangeStatus.Modified, account.Status);
            Assert.AreEqual(ChangeStatus.Added, tran1.Status);
            Debug.WriteLine(account.SaveChanges());
            Assert.AreEqual(1, account.TransactionCount);
            Assert.AreEqual(ChangeStatus.None, account.Status);
            Assert.AreEqual(ChangeStatus.None, tran1.Status);
        }
Exemple #4
0
        public void DeleteOrderTest()
        {
            FakeAccount     account = new FakeAccount(Guid.NewGuid(), "Acc2");
            FakeTransaction tran1   = new FakeTransaction(Guid.NewGuid(), "tran1", account);
            FakeOrder       order1  = new FakeOrder(tran1, Guid.NewGuid(), "order1", 2, 2);

            FakeTransaction tran2  = new FakeTransaction(Guid.NewGuid(), "tran2", account);
            FakeOrder       order2 = new FakeOrder(tran2, Guid.NewGuid(), "order2", 3, 3);

            Assert.AreEqual(2, account.TransactionCount);
            Assert.AreEqual(1, tran2.OrderCount);
            order1.LotBalance = 1;
            tran2.RemoveOrder(order2);
            Debug.WriteLine(account.SaveChanges());
            Assert.AreEqual(0, tran2.OrderCount);

            account.RemoveTran(tran2);
            Assert.AreEqual(2, account.TransactionCount);

            Debug.WriteLine(account.SaveChanges());
            Assert.AreEqual(1, account.TransactionCount);
        }
Exemple #5
0
 internal void RemoveTran(FakeTransaction tran)
 {
     _trans.RemoveItem(tran);
 }
Exemple #6
0
 internal void AddTran(FakeTransaction tran, OperationType type)
 {
     _trans.AddItem(tran, type);
 }