public void TestBookAndUnBook() { // Actors Account _cash = null, _cashCredit = null; OCurrency cashBalance1 = 0, cashBalance2 = 0; OCurrency cashBalance3 = 0, cashBalance4 = 0; Booking mvt = null; AccountingTransaction movementSet = null; // Activites chartOfAccounts.Accounts = new List <Account>(); _cash = new Account(); _cash.DebitPlus = true; _cash.Number = "1011"; _cash.Balance = 1000; _cash.TypeCode = "CASH"; _cash.CurrencyId = 1; _cashCredit = new Account(); _cashCredit.DebitPlus = true; _cashCredit.Number = "1031"; _cashCredit.TypeCode = "CASH_CREDIT"; _cashCredit.Balance = 0; _cashCredit.CurrencyId = 1; chartOfAccounts.AddAccount(_cash); chartOfAccounts.AddAccount(_cashCredit); movementSet = new AccountingTransaction(); // Asertions mvt = new Booking(2, _cashCredit, 100, cash, movementSet.Date, new Branch { Id = 1 }); movementSet.AddBooking(mvt); chartOfAccounts.Book(movementSet); cashBalance1 = chartOfAccounts.GetAccountByTypeCode("CASH", 1).Balance; cashBalance2 = chartOfAccounts.GetAccountByTypeCode("CASH_CREDIT", 1).Balance; chartOfAccounts.UnBook(movementSet); cashBalance3 = chartOfAccounts.GetAccountByTypeCode("CASH", 1).Balance; cashBalance4 = chartOfAccounts.GetAccountByTypeCode("CASH_CREDIT", 1).Balance; // Asertions Assert.AreEqual(1100m, cashBalance1.Value); Assert.AreEqual(-100m, cashBalance2.Value); Assert.AreEqual(1000m, cashBalance3.Value); Assert.AreEqual(0m, cashBalance4.Value); }