コード例 #1
0
        public override void Run(object context)
        {
            DbController dbc = new DbController(Connection);
            try
            {
                dbc.DeleteAddress(dbc.GetRandomCustomer().Address.AddressId);
                Fail("Customer constraint violation exception should have occurred");

                dbc.DeleteAddress(dbc.GetRandomSupplier().Address.AddressId);
                Fail("Supplier constraint violation exception should have occurred");
            }
            catch (Exception e)
            {
                Log(e);
            }
            finally
            {
                base.Run(context);
            }
        }
コード例 #2
0
        public override void Run(object context)
        {
            DbController dbc = new DbController(Connection);

            try
            {
                dbc.DeleteAddress(dbc.GetRandomCustomer().Address.AddressId);
                Fail("Customer constraint violation exception should have occurred");

                dbc.DeleteAddress(dbc.GetRandomSupplier().Address.AddressId);
                Fail("Supplier constraint violation exception should have occurred");
            }
            catch (Exception e)
            {
                Log(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);
            }
        }
コード例 #4
0
        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);
            }
        }