DeleteData() public static method

Deletes all remaining test objects.
public static DeleteData ( IZetboxContext ctx ) : void
ctx IZetboxContext this context is used to delete the objects
return void
Beispiel #1
0
 public override void TearDown()
 {
     using (var ctx = GetContext())
     {
         ctx.GetQuery <TestObjClass>().ForEach(obj => { obj.ObjectProp = null; ctx.Delete(obj); });
         ProjectDataFixture.DeleteData(ctx);
         ctx.SubmitChanges();
     }
     base.TearDown();
 }
Beispiel #2
0
        public override void SetUp()
        {
            base.SetUp();
            iftFactory = scope.Resolve <InterfaceType.Factory>();

            using (IZetboxContext ctx = GetContext())
            {
                ctx.GetQuery <TestObjClass>().ForEach(obj => { obj.ObjectProp = null; ctx.Delete(obj); });
                ProjectDataFixture.DeleteData(ctx);
                ctx.SubmitChanges();
            }

            using (IZetboxContext ctx = GetContext())
            {
                var list = new List <TestObjClass>();
                while (list.Count < 2)
                {
                    var newObj = ctx.Create <TestObjClass>();
                    newObj.ObjectProp = null; // kunde;
                    newObj.StringProp = "blah" + list.Count;
                    list.Add(newObj);
                }

                ctx.SubmitChanges();

                firstId              = list[0].ID;
                list[0].StringProp   = "First";
                list[0].TestEnumProp = TestEnum.First;

                secondId             = list[1].ID;
                list[1].StringProp   = "Second";
                list[1].TestEnumProp = TestEnum.Second;

                ctx.SubmitChanges();
            }
        }