Esempio n. 1
0
        public void ManyToManyUpdateTest()
        {
            using (EasySession easySession = new EasySession())
            {
                ///[Test Update] - many-to-many relationship
                ProductModelIllustration productModelIllustration = new ProductModelIllustration();
                int resultCount = productModelIllustration.Count(easySession);
                Assert.AreEqual(5, resultCount);

                ProductModel productModel = new ProductModel();
                resultCount = productModel.Count(easySession);
                Assert.AreEqual(129, resultCount);

                productModel.ProductModelID = 47;
                ProductModel resultList = productModel.Find(easySession, EasyLoad.Simple);

                //resultList.Illustration.RemoveAt(0);
                bool result = resultList.Update(easySession);

                resultCount = resultList.Count(easySession);
                Assert.AreEqual(129, resultCount);

                resultCount = productModelIllustration.Count(easySession);
                Assert.AreEqual(5, resultCount);
            }
        }
Esempio n. 2
0
        public void ManyToOneReadTest()
        {
            using (EasySession easySession = new EasySession())
            {
                ///[Test Read] - many-to-one relationship
                ProductSubcategory productSubcategory = new ProductSubcategory();
                IList resultList = productSubcategory.FindAll(easySession);

                Assert.AreEqual(38, resultList.Count);
            }
        }
Esempio n. 3
0
        public void OneToManyReadTest()
        {
            using (EasySession easySession = new EasySession())
            {
                ///[Test Read] - one-to-many relationship
                ProductCategory productCategory = new ProductCategory();
                IList resultList = productCategory.FindAll(easySession);

                Assert.AreEqual(4, resultList.Count);
            }
        }
Esempio n. 4
0
        public void OneToOneReadTest()
        {
            using (EasySession easySession = new EasySession())
            {
                ///[Test Read] - one-to-one relationship
                Customer customer = new Customer();
                IList resultList = customer.FindAll(easySession);

                Assert.AreEqual(19185, resultList.Count);
            }
        }
Esempio n. 5
0
        public void SimpleExistsTest()
        {
            using (EasySession easySession = new EasySession())
            {
                ///[Test Read] - without relationship
                Location location = new Location();
                bool resultList = location.Exists(easySession, 8);

                Assert.IsTrue(resultList, "It does not exists.");
            }
        }
Esempio n. 6
0
        public void SimpleCountTest()
        {
            using (EasySession easySession = new EasySession())
            {
                ///[Test Read] - without relationship
                Location location = new Location();
                int resultList = location.Count(easySession);

                Assert.AreEqual(14, resultList);
            }
        }
Esempio n. 7
0
        public void SimpleCountByPropertyAndTypeTest()
        {
            using (EasySession easySession = new EasySession())
            {
                ///[Test Read] - without relationship
                Location location = new Location();
                int resultList = location.Count(easySession, "Availability", 120.00);

                Assert.AreEqual(4, resultList);
            }
        }
Esempio n. 8
0
        public void SimpleExistsByPropertyByInstanceTest()
        {
            using (EasySession easySession = new EasySession())
            {
                ///[Test Read] - without relationship
                Location location = new Location();
                location.Availability = 120.00M;
                bool resultList = location.Exists(easySession, "Availability");

                Assert.IsTrue(resultList, "It does not exists.");
            }
        }
Esempio n. 9
0
        public void OneToOneReadByPrimaryKeyTest()
        {
            using (EasySession easySession = new EasySession())
            {
                ///[Test Read] - one-to-one relationship
                Customer customer = new Customer();
                customer.CustomerID = 11000;

                Customer resultList = customer.Find(easySession);

                Assert.IsNotNull(resultList, "Result is null");
            }
        }
Esempio n. 10
0
        protected void SPTest()
        {
            using (EasySession easySession = new EasySession())
            {
                ProductModel productModel = new ProductModel();
                int resultCount = productModel.Count(easySession);
                Assert.AreEqual(129, resultCount);

                ObjectQuery testOQ = new ObjectQuery();
                //testOQ.DeleteSP("uspDeleteProductModels", easySession).SetParameterList("list", new int[] { 1, 2, 3 }, typeof(int)).Execute();

                resultCount = productModel.Count(easySession);
                Assert.AreEqual(126, resultCount);
            }
        }
Esempio n. 11
0
        public void SimpleDeleteAllTest()
        {
            using (EasySession easySession = new EasySession())
            {
                ///[Test Create] - without relationship
                Location location = new Location();

                int resultCount = location.Count(easySession);
                Assert.AreEqual(9, resultCount);

                bool result = location.DeleteAll(easySession);

                resultCount = location.Count(easySession);
                Assert.AreEqual(0, resultCount);
            }
        }
Esempio n. 12
0
        public void SimpleDeleteUsingWhereTest()
        {
            using (EasySession easySession = new EasySession())
            {
                ///[Test Create] - without relationship
                Location location = new Location();

                int resultCount = location.Count(easySession);
                Assert.AreEqual(13, resultCount);

                bool result = location.DeleteAllByCustomWhere(easySession, "Availability = 120.00");

                resultCount = location.Count(easySession);
                Assert.AreEqual(9, resultCount);
            }
        }
Esempio n. 13
0
        protected void QueryTest()
        {
            using (EasySession easySession = new EasySession())
            {
                ProductModel productModel = new ProductModel();
                int resultCount = productModel.Count(easySession);
                Assert.AreEqual(129, resultCount);

                ObjectQuery testOQ = new ObjectQuery();
                //testOQ.EasyQuery(easySession).From(productModel.GetType()).Where().
                //var result = testOQ.DeleteQuery("DELETE FROM Production.ProductModel WHERE ProductModelID IN (:list)", easySession).SetParameterList("list", new int[] { 1, 2, 3 }, typeof(int)).Execute();

                resultCount = productModel.Count(easySession);
                Assert.AreEqual(126, resultCount);
            }
        }
Esempio n. 14
0
        public void ManyToManyReadTest()
        {
            using (EasySession easySession = new EasySession())
            {
                ///[Test Read] - many-to-many relationship
                ProductModel productModel = new ProductModel();
                //IList resultList = productModel.FindAll(easySession); //, EasyLoad.None
                List<ProductModel> resultList = productModel.FindAll(easySession, EasyLoad.Simple);

                //ProductModels test = new ProductModels();
                //test.d
                //ProductModels ProductList = (ProductModels)Convert.ChangeType(resultList, typeof(ProductModels));

                Assert.AreEqual(129, resultList.Count);
            }
        }
Esempio n. 15
0
        public void SimpleUpdateTest()
        {
            using (EasySession easySession = new EasySession())
            {
                ///[Test Update] - without relationship
                ProductCategory productCategory = new ProductCategory();

                int resultCount = productCategory.Count(easySession);
                Assert.AreEqual(5, resultCount);

                productCategory.ProductCategoryID = 5;
                productCategory.Name = "Test Category Update";
                //productCategory.Rowguid = Guid.NewGuid();
                productCategory.ModifiedDate = DateTime.Now;
                bool result = productCategory.Update(easySession);

                resultCount = productCategory.Count(easySession);
                Assert.AreEqual(5, resultCount);
            }
        }
Esempio n. 16
0
        public void ReadByPropertyTest()
        {
            using (EasySession easySession = new EasySession())
            {
                ///[Test Read] - one-to-one relationship
                Location location = new Location();
                location.ModifiedDate = Convert.ToDateTime("6/1/1998");

                List<Location> resultList = location.FindAll(easySession, "ModifiedDate");

                Assert.IsNotNull(resultList, "Result is null");
            }
        }
Esempio n. 17
0
        public void SimpleReadByPropertyInstanceTest()
        {
            using (EasySession easySession = new EasySession())
            {
                ///[Test Read] - without relationship
                Location location = new Location();
                location.Availability = 120.00M;

                IList resultList = location.FindAll(easySession, "Availability");
                GridView1.DataSource = resultList;
                GridView1.DataBind();

                Assert.AreEqual(4, resultList.Count);
            }
        }
Esempio n. 18
0
        public void SimpleReadByPrimaryKeyTypeTest()
        {
            using (EasySession easySession = new EasySession())
            {
                ///[Test Read] - without relationship
                Location location = new Location();
                object id = 1;

                Location resultList = location.Find(easySession, id);

                Assert.IsNotNull(resultList, "Result is null");
            }
        }