public void SaveTest() { var account1 = new Account(); account1.Number = 2345235; account1.Agency = 166; var owner = new Person(); owner.Name = "Ryu Ken"; owner.Document = "3451345"; owner.Email = "*****@*****.**"; account1.Owner = owner; account1.Save(); var account2 = new Account(); account2.Number = 464567; account2.Agency = 345; owner.Accounts.Add(account2); owner.Save(); var accountsRepository = new AccountsRepository(); var accounts = accountsRepository.Find(a => a.PERSON.Id == owner.Id); Assert.IsNotNull(accounts); Assert.AreEqual(2, accounts.Count); Assert.IsTrue(accounts.Contains(account1)); Assert.IsTrue(accounts.Contains(account2)); }
public void SaveTest() { Account account = new Account(); account.Number = 2345235; account.Agency = 166; Person owner = new Person(); owner.Name = "Ryu Ken"; owner.Document = "3451345"; owner.Email = "*****@*****.**"; account.Owner = owner; account.Save(); AccountsRepository accountsRepository = new AccountsRepository(); Assert.IsNotNull(accountsRepository.FindSingle(a => a.Id == account.Id)); Assert.IsNotNull(accountsRepository.FindSingle(a => a.PERSON.Name == owner.Name)); Assert.IsNotNull(accountsRepository.FindSingle(a => a.PERSON.Id == owner.Id)); }