Ejemplo n.º 1
0
        public void ChangesTest()
        {
            ProductCategory category = Changes.Create();

            Changes.Update(category.ProductCategoryID, category.ProductSubcategories.Single().ProductSubcategoryID);
            Changes.SaveNoChanges(1);
            Changes.UpdateWithoutRead(category.ProductCategoryID);
            Changes.Delete(category.ProductSubcategories.Single().ProductSubcategoryID);
            Changes.DeleteWithoutRead(category.ProductCategoryID);
            try
            {
                Changes.DeleteWithRelationship(1);
                Assert.Fail();
            }
            catch (DbUpdateException exception)
            {
                Trace.WriteLine(exception);
            }
            category = Changes.Create();
            Changes.DeleteCascade(category.ProductCategoryID);
            try
            {
                Changes.UntrackedChanges();
                Assert.Fail();
            }
            catch (DbUpdateException exception)
            {
                Trace.WriteLine(exception);
            }
        }
Ejemplo n.º 2
0
 public void ChangesTest()
 {
     using (TransactionScope scope = new TransactionScope())
     {
         int subcategoryId = Changes.Create();
         Changes.Update();
         Changes.UpdateWithNoChange();
         Changes.Delete();
         Changes.DeleteWithNoQuery(subcategoryId);
         Changes.DeleteWithRelationship();
         try
         {
             Changes.UntrackedChanges();
             Assert.Fail();
         }
         catch (InvalidOperationException exception)
         {
             Trace.WriteLine(exception);
         }
         scope.Complete();
     }
 }