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 { Category category = (Category)ObjectFactory.Create(ObjectType.Category); dbc.AddCategory(category); Category result = dbc.GetCategory(category.CategoryId); if (result == null) { Fail("Failed to insert new Category record"); return; } else if (!category.Equals(result)) { Fail("Inserted Category record having inconsistent data"); return; } category = (Category)ObjectFactory.Create(ObjectType.Category); category.CategoryId = result.CategoryId; dbc.UpdateCategory(category); result = dbc.GetCategory(category.CategoryId); if (!category.Equals(result)) { Fail("Failed to update Category record"); return; } dbc.DeleteCategory(category.CategoryId); if (dbc.GetCategory(category.CategoryId) != null) { Fail("Failed to delete Category record"); } } catch (Exception e) { Fail(e); } finally { base.Run(context); } }
public override void Run(object context) { DbController dbc = new DbController(Connection); try { Category category = (Category)ObjectFactory.Create(ObjectType.Category); dbc.AddCategory(category); Category result = dbc.GetCategory(category.CategoryId); if (result == null) { Fail("Failed to insert new Category record"); return; } else if (!category.Equals(result)) { Fail("Inserted Category record having inconsistent data"); return; } category = (Category)ObjectFactory.Create(ObjectType.Category); category.CategoryId = result.CategoryId; dbc.UpdateCategory(category); result = dbc.GetCategory(category.CategoryId); if (!category.Equals(result)) { Fail("Failed to update Category record"); return; } dbc.DeleteCategory(category.CategoryId); if (dbc.GetCategory(category.CategoryId) != null) Fail("Failed to delete Category record"); } catch (Exception e) { Fail(e); } finally { base.Run(context); } }