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); Address result = dbc.GetAddress(address.AddressId); if (result == null) { Fail("Failed to insert new Address record"); return; } else if (!address.Equals(result)) { Fail("Inserted Address record having inconsistent data"); return; } address = (Address)ObjectFactory.Create(ObjectType.Address); address.AddressId = result.AddressId; dbc.UpdateAddress(address); result = dbc.GetAddress(address.AddressId); if (!address.Equals(result)) { Fail("Failed to update Address record"); return; } dbc.DeleteAddress(address.AddressId); if (dbc.GetAddress(address.AddressId) != null) { Fail("Failed to delete Address 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); Address result = dbc.GetAddress(address.AddressId); if (result == null) { Fail("Failed to insert new Address record"); return; } else if (!address.Equals(result)) { Fail("Inserted Address record having inconsistent data"); return; } address = (Address)ObjectFactory.Create(ObjectType.Address); address.AddressId = result.AddressId; dbc.UpdateAddress(address); result = dbc.GetAddress(address.AddressId); if (!address.Equals(result)) { Fail("Failed to update Address record"); return; } dbc.DeleteAddress(address.AddressId); if (dbc.GetAddress(address.AddressId) != null) Fail("Failed to delete Address record"); } catch (Exception e) { Fail(e); } finally { base.Run(context); } }