Example #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);
            }
        }
Example #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);
            }
        }
Example #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);
            }
        }
Example #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);
            }
        }
Example #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.");
            }
        }
Example #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);
            }
        }
Example #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);
            }
        }
Example #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.");
            }
        }
Example #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");
            }
        }
Example #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);
            }
        }
Example #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);
            }
        }
Example #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);
            }
        }
Example #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);
            }
        }
Example #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);
            }
        }
Example #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);
            }
        }
Example #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");
            }
        }
Example #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);
            }
        }
Example #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");
            }
        }