/// <summary> /// Verify that the input account is equal to the account(id=1). /// </summary> /// <param name="account">An account object</param> protected void AssertAccount5(Account account) { Assert.AreEqual(5, account.Id, "account.Id"); Assert.AreEqual("Gilles", account.FirstName, "account.FirstName"); Assert.AreEqual("Bayon", account.LastName, "account.LastName"); Assert.AreEqual("*****@*****.**", account.EmailAddress, "account.EmailAddress"); }
public void TransactionalUsage() { container = CreateConfiguredContainer(); container.AddFacility("IBatisNet", new IBatisNetFacility()); container.AddFacility("transaction", new TransactionFacility()); container.AddComponent("AccountDao", typeof (IAccountDao), typeof (AccountDao)); container.AddComponent("Service", typeof (IService), typeof (Service)); ResetDatabase(); IService service = container["Service"] as IService; Account account = new Account(); account.Id = 999; account.EmailAddress = "*****@*****.**"; account.FirstName = "Gilles"; account.LastName = "Bayon"; service.InsertTransactionalAccount(account); account = null; account = service.GetAccountWithSpecificDataMapper(999) as Account; Assert.IsNotNull(account); Assert.AreEqual(999, account.Id, "account.Id"); }
/// <summary> /// Verify that the input account is equal to the account(id=5). /// </summary> /// <param name="account">An account object</param> protected void AssertAccount1(Account account) { Assert.AreEqual(1, account.Id, "account.Id"); Assert.AreEqual("Joe", account.FirstName, "account.FirstName"); Assert.AreEqual("Dalton", account.LastName, "account.LastName"); Assert.AreEqual("*****@*****.**", account.EmailAddress, "account.EmailAddress"); }
public void Usage() { IWindsorContainer container = CreateConfiguredContainer(); container.AddFacility("IBatisNet", new IBatisNetFacility()); SqlMapper sqlMap = container[DATA_MAPPER] as SqlMapper; using (IDalSession session = sqlMap.OpenConnection()) { Account account = new Account(); account.Id = 99; account.EmailAddress = "*****@*****.**"; account.FirstName = "Gilles"; account.LastName = "Bayon"; sqlMap.Insert("InsertAccount", account); account = null; account = sqlMap.QueryForObject("GetAccount", 99) as Account; Assert.AreEqual(99, account.Id, "account.Id"); } }
public void CommonUsage() { container = CreateConfiguredContainer(); container.AddFacility("IBatisNet", new IBatisNetFacility()); container.AddComponent("AccountDao", typeof (IAccountDao), typeof (AccountDao)); ResetDatabase(); IAccountDao dao = container["AccountDao"] as AccountDao; Account account = new Account(); account.Id = 99; account.EmailAddress = "*****@*****.**"; account.FirstName = "Gilles"; account.LastName = "Bayon"; dao.InsertAccount(account); account = null; account = dao.GetAccount(99) as Account; Assert.IsNotNull(account); Assert.AreEqual(99, account.Id, "account.Id"); }
public void InsertTransactionalAccountWithError(Account account) { _accountDao.InsertAccount(account); throw new ApplicationException("Ugh!"); }
public void InsertTransactionalAccount(Account account) { _accountDao.InsertAccount(account); }
public void InsertAccount(Account account) { _accountDao.InsertAccount(account); }
public void InsertAccount(Account account) { _sqlMap.Insert("InsertAccount", account); }
public void ExecuteMethodUntilSignal() { Random _random = new Random(); _startEvent.WaitOne(int.MaxValue, false); while (!_stopEvent.WaitOne(1, false)) { int id = _random.Next(); Account account = new Account(); account.Id = id; account.EmailAddress = "*****@*****.**"; account.FirstName = "Gilles"; account.LastName = "Bayon"; _dao.InsertAccount(account); account = null; account = _dao.GetAccount(id); Assert.IsNotNull(account); } }
public void Rollback() { container = CreateConfiguredContainer(); container.AddFacility("IBatisNet", new IBatisNetFacility()); container.AddFacility("transaction", new TransactionFacility()); container.AddComponent("AccountDao", typeof (IAccountDao), typeof (AccountDao)); container.AddComponent("Service", typeof (IService), typeof (Service)); ResetDatabase(); IService service = container["Service"] as IService; Account account = new Account(); account.Id = 999; account.EmailAddress = "*****@*****.**"; account.FirstName = "Transaction"; account.LastName = "Error"; try { service.InsertTransactionalAccountWithError(account); Assert.Fail("Exception was expected"); } catch (Exception) { // Expected } account = null; account = service.GetAccountWithSpecificDataMapper(999) as Account; Assert.IsNull(account); }