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); } }
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); } }
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); } }