public void TestCleanup()
 {
     try
     {
         MapRepository.Instance.EnableTraceLogging = false;
         _db.Delete <FluentMappedReceipt>(r => r.OrderItemID > 0);
         _db.Delete <FluentMappedOrderItem>(oi => oi.ID > 0);
         _db.Delete <FluentMappedOrder>(o => o.ID > 0);
     }
     finally
     {
         _db.Dispose();
     }
 }
Esempio n. 2
0
        public void TestRegionInsertAndDelete()
        {
            //
            // Create and Insert new Region
            //
            Region c = new Region()
            {
                RegionID          = 17,
                RegionDescription = "Central",
            };
            object id = regions.Insert(c);
            //
            // Get the new Region object from database
            //
            Region actual            = (Region)regions.GetById(id);
            string regionDescription = actual.RegionDescription;
            string trimmedResult     = regionDescription.Trim();

            trimmedResult = Regex.Replace(trimmedResult, @"\t|\n|\r", "");
            Assert.AreEqual(c.RegionDescription, trimmedResult);
            //
            // Delete the created Region from database
            //
            regions.Delete(actual);
            object res = regions.GetById(id);

            actual = res != null ? (Region)res : default(Region);

            Assert.IsNull(res);
        }
Esempio n. 3
0
        public void TestEmployeeInsertAndDelete()
        {
            Employee e = new Employee()
            {
                LastName        = "Silva",
                FirstName       = "Manuel",
                Title           = "Sales Representative",
                TitleOfCourtesy = "Mr.",
                Address         = "There",
                City            = "This one",
                Region          = "That one",
                PostalCode      = "IDK",
                Country         = "Portugal",
                HomePhone       = "(206) 555-9857",
                Extension       = "100"
            };
            object id = employee.Insert(e);
            //
            // Get the new employee object from database
            //
            Employee actual = (Employee)employee.GetById(id);

            Assert.AreEqual(e.LastName, actual.LastName);
            Assert.AreEqual(e.FirstName, actual.FirstName);
            //
            // Delete the created employee from database
            //
            employee.Delete(actual);
            object res = employee.GetById(id);

            actual = res != null ? (Employee)res : default(Employee);
            Assert.IsNull(actual.LastName);
            Assert.IsNull(actual.FirstName);
        }
        public void TestShipperInsertAndDelete()
        {
            //
            // Create and Insert new Shipper
            //
            Shipper c = new Shipper()
            {
                CompanyName = "New Company",
                Phone       = "(555) 123-4567"
            };
            object id = shippers.Insert(c);
            //
            // Get the new category object from database
            //
            Shipper actual = (Shipper)shippers.GetById(id);

            Assert.AreEqual(c.CompanyName, actual.CompanyName);
            Assert.AreEqual(c.Phone, actual.Phone);
            //
            // Delete the created category from database
            //
            shippers.Delete(actual);
            object res = shippers.GetById(id);

            actual = res != null ? (Shipper)res : default(Shipper);
            Assert.IsNull(actual.CompanyName);
            Assert.IsNull(actual.Phone);
        }
        public void TestProductInsertAndDelete()
        {
            //
            // Create and insert a new product
            //
            Category c = (Category)categories.GetById(4);
            Supplier s = (Supplier)suppliers.GetById(17);
            Product  p = new Product()
            {
                Category     = c,
                Supplier     = s,
                ProductName  = "Bacalhau",
                ReorderLevel = 23,
                UnitsInStock = 100,
                UnitsOnOrder = 40
            };
            object id = prods.Insert(p);
            //
            // Get the new product object from database
            //
            Product actual = (Product)prods.GetById(id);

            Assert.AreEqual(p.ProductName, actual.ProductName);
            Assert.AreEqual(p.UnitsInStock, actual.UnitsInStock);
            //
            // Delete the created product from database
            //
            prods.Delete(actual);
            actual = (Product)prods.GetById(id);
            Assert.IsNull(actual);
        }
Esempio n. 6
0
        public void TestRegionInsertAndDelete()
        {
            //
            // Create and Insert new Region
            //
            Region r = new Region()
            {
                RegionID          = 5,
                RegionDescription = "Northwest                                         "
            };
            object id = regions.Insert(r);
            //
            // Get the new Region object from database
            //
            Region actual = (Region)regions.GetById(id);

            Assert.AreEqual(r.RegionDescription, actual.RegionDescription);
            //
            // Delete the created Region from database
            //
            regions.Delete(actual);
            object res = regions.GetById(id);

            actual = res != null ? (Region)res : default(Region);
            Assert.IsNull(actual.RegionDescription);
        }
Esempio n. 7
0
        public void TestCategoryInsertAndDelete()
        {
            //
            // Create and Insert new Category
            //
            Category c = new Category()
            {
                CategoryName = "Fish",
                Description  = "Live under water!"
            };
            object id = categories.Insert(c);
            //
            // Get the new category object from database
            //
            Category actual = (Category)categories.GetById(id);

            Assert.AreEqual(c.CategoryName, actual.CategoryName);
            Assert.AreEqual(c.Description, actual.Description);
            //
            // Delete the created category from database
            //
            categories.Delete(actual);
            object res = categories.GetById(id);

            actual = res != null ? (Category)res : default(Category);
            Assert.IsNull(actual.CategoryName);
            Assert.IsNull(actual.Description);
        }
        internal void TestRegionInsertAndDelete()
        {
            //
            // Create and Insert new Region

            Region r = new Region()
            {
                RegionID          = 12,
                RegionDescription = "Western                                           ",
            };
            object id = regions.Insert(r);
            //
            // Get the new region object from database
            //
            Region actual = (Region)regions.GetById(12);

            Assert.AreEqual(r.RegionID, actual.RegionID);
            Assert.AreEqual(r.RegionDescription, actual.RegionDescription);

            // Delete the created region from database
            //
            regions.Delete(actual);
            object res = regions.GetById(12);

            actual = res != null ? (Region)res : default(Region);
            Assert.IsNull(actual);
        }
Esempio n. 9
0
        public void CustomersDelete()
        {
            Customer cust1 = new Customer();

            cust1.CustomerID = "SERRA";
            custMapper.Delete(cust1);
            int res = connMan.GetAffectedRows();

            Assert.IsTrue(res == 1);
        }
Esempio n. 10
0
        public static void EmployeeEmit()
        {
            IDataMapper test   = EmitDataMapper.Build(typeof(Employee), connStr, true);
            object      id     = test.Insert(tester);
            IEnumerable res    = test.GetAll();
            Employee    actual = (Employee)test.GetById(id);

            test.Delete(actual);
            Employee original = (Employee)test.GetById(1);

            test.Update(tester);
            test.Update(original);
        }
Esempio n. 11
0
        public static void CustomerEmit()
        {
            IDataMapper test   = EmitDataMapper.Build(typeof(Customer), connStr, true);
            object      id     = test.Insert(insertTestC);
            IEnumerable res    = test.GetAll();
            Customer    actual = (Customer)test.GetById(id);

            test.Delete(actual);
            Customer original = (Customer)test.GetById("ALFKI");

            test.Update(updateTestC);
            test.Update(original);
        }
Esempio n. 12
0
        internal int Delete(string statementName, object parameterObject)
        {
            int num = 0;

            try
            {
                num = dataMapper.Delete(statementName, parameterObject);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(num);
        }
        public void TestCustomerInsertAndDelete()
        {
            //
            // Create and Insert new Customer
            //
            Customer c = new Customer()
            {
                CustomerID  = "TESTE",
                CompanyName = "Testing code",
                ContactName = "Programmer",
                Address     = "IP",
                City        = "Lisbon",
                PostalCode  = "IDK",
                Region      = "Potato",
                Country     = "Test",
                Phone       = "None",
                Fax         = "see above"
            };
            object id = customers.Insert(c);
            //
            // Get the new Customer object from database
            //
            Customer actual = (Customer)customers.GetById(id);

            Assert.AreEqual(actual.CustomerID, c.CustomerID);
            Assert.AreEqual(actual.CompanyName, c.CompanyName);
            Assert.AreEqual(actual.ContactName, c.ContactName);
            Assert.AreEqual(actual.Address, c.Address);
            Assert.AreEqual(actual.City, c.City);
            Assert.AreEqual(actual.PostalCode, c.PostalCode);
            Assert.AreEqual(actual.Region, c.Region);
            Assert.AreEqual(actual.Country, c.Country);
            Assert.AreEqual(actual.Phone, c.Phone);
            Assert.AreEqual(actual.Fax, c.Fax);
            //
            // Delete the created Customer from database
            //
            customers.Delete(actual);
            object res = customers.GetById(id);

            actual = res != null ? (Customer)res : default(Customer);
            Assert.IsNull(actual);
        }
Esempio n. 14
0
        public static void ProductEmit()
        {
            IDataMapper test       = EmitDataMapper.Build(typeof(Product), connStr, true);
            IDataMapper categories = EmitDataMapper.Build(typeof(Category), connStr, true);
            IDataMapper suppliers  = EmitDataMapper.Build(typeof(Supplier), connStr, true);

            Category c = (Category)categories.GetById(4);
            Supplier s = (Supplier)suppliers.GetById(17);

            object      id     = test.Insert(ProductBuilder(c, s));
            IEnumerable res    = test.GetAll();
            Product     actual = (Product)test.GetById(id);

            test.Delete(actual);

            Product original = (Product)test.GetById(10);

            c = (Category)categories.GetById(4);
            s = (Supplier)suppliers.GetById(17);


            test.Update(ProductBuilder(c, s));
            test.Update(original);
        }
Esempio n. 15
0
 public int DeleteEntity(T entity)
 {
     throw new Exception();
     return(DataMapper.Delete(typeof(T).Name + ConfigurationManager.AppSettings["DeleteSuffix"], entity));
 }
 public void Remove(T entity)
 {
     // throw new NotImplementedException();
     // _dataSet.Remove(entity);
     _dataMapper.Delete(entity);
 }
 public void Remove(T entity)
 {
     // throw new NotImplementedException(); // Again I have to send this to the under layer it knows better the object
     // Othervise I have to make sure each object has Id with Interface or Abstract class
     _dataMapper.Delete(entity);
 }
Esempio n. 18
0
 public void Delete(long id)
 {
     _profileDataMapper.Delete(id);
 }
Esempio n. 19
0
 public void Delete(long id)
 {
     _moduleDataMapper.Delete(id);
 }