public void TestAddBooking() { movementSet.AddBooking(new Booking(1, new Account("300000", "third account"), 500, new Account("0", "forth account"), movementSet.Date, new Branch { Id = 1 })); Assert.AreEqual(1, movementSet.Bookings.Count); }
public void TestMergeTwoMovementSet() { AccountingTransaction mvt1 = new AccountingTransaction(); mvt1.Bookings = new List <Booking>(); mvt1.AddBooking(new Booking(1, new Account("100000", "first1 account"), 1000, new Account("100000", "first2 account"), movementSet.Date, new Branch { Id = 1 })); mvt1.AddBooking(new Booking(2, new Account("100000", "first3 account"), 1000, new Account("100000", "first4 account"), movementSet.Date, new Branch { Id = 1 })); Assert.AreEqual(2, mvt1.Bookings.Count); AccountingTransaction mvt2 = new AccountingTransaction(); mvt2.Bookings = new List <Booking>(); mvt2.AddBooking(new Booking(1, new Account("100000", "second1 account"), 1000, new Account("100000", "second2 account"), movementSet.Date, new Branch { Id = 1 })); mvt2.AddBooking(new Booking(2, new Account("100000", "second3 account"), 1000, new Account("100000", "second4 account"), movementSet.Date, new Branch { Id = 1 })); Assert.AreEqual(2, mvt2.Bookings.Count); mvt1.Merge(mvt2); Assert.AreEqual(4, mvt1.Bookings.Count); }
public void AddAccoutingTransaction_WithBooking() { AccountingTransactionManager accountingTransactionManager = (AccountingTransactionManager)container["AccountingTransactionManager"]; AccountingTransaction accountingTransaction = new AccountingTransaction { Date = new DateTime(2009, 2, 3), User = new User { Id = 1 } }; accountingTransaction.AddBooking(new Booking { Number = 1, Amount = 1000, CreditAccount = new Account { Id = 1 }, DebitAccount = new Account { Id = 2 }, Label = OAccountingLabels.Capital }); accountingTransaction.AddBooking(new Booking { Number = 2, Amount = 1000, CreditAccount = new Account { Id = 2 }, DebitAccount = new Account { Id = 4 }, Label = OAccountingLabels.Fees }); }
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); }
public void TestBook() { Account 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); // OMFS-200 AccountingTransaction movementSet = new AccountingTransaction(); Booking mvt = new Booking(2, cashCredit, 100, cash, movementSet.Date, new Branch { Id = 1 }); movementSet.AddBooking(mvt); chartOfAccounts.Book(movementSet); Assert.AreEqual(1100m, chartOfAccounts.GetAccountByTypeCode("CASH", 1).Balance.Value); Assert.AreEqual(-100m, chartOfAccounts.GetAccountByTypeCode("CASH_CREDIT", 1).Balance.Value); }