public override void Run(object context) { DbController dbc = new DbController(Connection); try { Address address = (Address)ObjectFactory.Create(ObjectType.Address); Category category = (Category)ObjectFactory.Create(ObjectType.Category); dbc.AddAddress(address); dbc.AddCategory(category); if (dbc.GetAddress(address.AddressId) != null) Fail("Failed to delete address that has no FK constraint"); if (dbc.GetCategory(category.CategoryId) != null) Fail("Failed to delete category that has no FK constraint"); } catch (Exception e) { Fail(e); } finally { base.Run(context); } }
public override void Run(object context) { DbController dbc = new DbController(Connection); try { Address address = (Address)ObjectFactory.Create(ObjectType.Address); Category category = (Category)ObjectFactory.Create(ObjectType.Category); dbc.AddAddress(address); dbc.AddCategory(category); if (dbc.GetAddress(address.AddressId) != null) { Fail("Failed to delete address that has no FK constraint"); } if (dbc.GetCategory(category.CategoryId) != null) { Fail("Failed to delete category that has no FK constraint"); } } catch (Exception e) { Fail(e); } finally { base.Run(context); } }
public override void Run(object context) { DbController dbc = new DbController(Connection); try { Address address = (Address)ObjectFactory.Create(ObjectType.Address); dbc.AddAddress(address); Supplier supplier = (Supplier)ObjectFactory.Create(ObjectType.Supplier); supplier.Address = address; dbc.AddSupplier(supplier); Supplier result = dbc.GetSupplier(supplier.SupplierId); if (result == null) { Fail("Failed to insert new Supplier record"); return; } else if (!supplier.Equals(result)) { Fail("Inserted Supplier record having inconsistent data"); return; } supplier = (Supplier)ObjectFactory.Create(ObjectType.Supplier); supplier.SupplierId = result.SupplierId; dbc.UpdateSupplier(supplier); result = dbc.GetSupplier(supplier.SupplierId); if (!supplier.Equals(result)) { Fail("Failed to update Supplier record"); return; } dbc.DeleteSupplier(supplier.SupplierId); if (dbc.GetSupplier(supplier.SupplierId) != null) { Fail("Failed to delete Supplier record"); } } catch (Exception e) { Fail(e); } finally { base.Run(context); } }
public override void Run(object context) { DbController dbc = new DbController(Connection); try { Address address = (Address)ObjectFactory.Create(ObjectType.Address); dbc.AddAddress(address); Customer customer = (Customer)ObjectFactory.Create(ObjectType.Customer); customer.Address = address; dbc.AddCustomer(customer); Customer result = dbc.GetCustomer(customer.CustomerId); if (result == null) { Fail("Failed to insert new Customer record"); return; } else if (!customer.Equals(result)) { Fail("Inserted Customer record having inconsistent data"); return; } customer = (Customer)ObjectFactory.Create(ObjectType.Customer); customer.CustomerId = result.CustomerId; dbc.UpdateCustomer(customer); result = dbc.GetCustomer(customer.CustomerId); if (!customer.Equals(result)) { Fail("Failed to update Customer record"); return; } dbc.DeleteCustomer(customer.CustomerId); if (dbc.GetCustomer(customer.CustomerId) != null) Fail("Failed to delete Customer record"); } catch (Exception e) { Fail(e); } finally { base.Run(context); } }