public void GetOperationsByAccount_SomeOperationsFound() { IOperationRepository operationRepository = new OperationRepository(NhibernateHelper.SessionFactory); Repository repository = new Repository(NhibernateHelper.SessionFactory); Customer thirdParty1 = new Customer { Code = "tjdsklfs", Email = "*****@*****.**", FirstName = "Olivier", LastName = "Roux", Password = "******", PasswordSalt = "sss" }; Account account1 = new Account { Balance = 201, BalanceDate = DateTime.Now, Number = "dsf1", Iban = "1242255" }; Account account2 = new Account { Balance = 201, BalanceDate = DateTime.Now, Number = "dsf1", Iban = "1242255" }; Operation operation1 = new Operation { Account = account1, Amount = 200, Direction = Direction.Credit, Motif = "blabla", TransactionCode = "1245" }; Operation operation2 = new Operation { Account = account1, Amount = 654, Direction = Direction.Debit, Motif = "blibli", TransactionCode = "1245" }; using (NhibernateHelper.SessionFactory.GetCurrentSession().BeginTransaction()) { repository.Save(thirdParty1); repository.Save(account1); repository.Save(account2); repository.Save(operation1); repository.Save(operation2); repository.Flush(); IList <Operation> operations = operationRepository.GetOperationsByAccount(account1.Id); Assert.AreEqual(2, operations.Count); } }