public static void NewEditableList(EventHandler <DataPortalResult <TestBusinessBindingList> > callback)
        {
            var portal = new Csla.DataPortal <TestBusinessBindingList>();

            portal.CreateCompleted += callback;
            portal.BeginCreate();
        }
Exemplo n.º 2
0
        public void MultipleAttributes()
        {
            var context = GetContext();

            var dp = new Csla.DataPortal <Multiple>();

            dp.CreateCompleted += (o, e) =>
            {
                if (e.Error != null)
                {
                    context.Assert.Fail(e.Error);
                }
                else
                {
                    var root  = e.Object;
                    var rules = root.GetRules();

                    Assert.AreEqual(3, rules.Length, "Should be 3 rules");
                    Assert.IsFalse(root.IsValid, "Obj shouldn't be valid");
                    Assert.AreEqual(1, root.BrokenRulesCollection.Count, "Should be 1 broken rule");
                    root.Name = "xyz";
                    Assert.AreEqual(2, root.BrokenRulesCollection.Count, "Should be 2 broken rules after edit");
                }
                context.Assert.Success();
            };
            dp.BeginCreate();

            context.Complete();
        }
Exemplo n.º 3
0
        public void CustomAttribute()
        {
            var context = GetContext();

            var dp = new Csla.DataPortal <Custom>();

            dp.CreateCompleted += (o, e) =>
            {
                var root  = e.Object;
                var rules = root.GetRules();

                Assert.AreEqual(1, rules.Length, "Should be 1 rule");
                Assert.IsFalse(root.IsValid, "Obj shouldn't be valid");
                Assert.AreEqual(1, root.BrokenRulesCollection.Count, "Should be 1 broken rule");
                Assert.AreEqual("Name must be abc", root.BrokenRulesCollection[0].Description, "Desc should match");
                context.Assert.Success();
            };
            dp.BeginCreate();

            context.Complete();
        }