public void ListTestSaveWhileNotBusy() { #if SILVERLIGHT DataPortal.ProxyTypeName = "Local"; #else System.Configuration.ConfigurationManager.AppSettings["CslaAutoCloneOnUpdate"] = "false"; #endif UnitTestContext context = GetContext(); ItemWithAsynchRuleList items = ItemWithAsynchRuleList.GetListWithItems(); items[0].ValidationComplete += (o2, e2) => { context.Assert.IsFalse(items.IsBusy); context.Assert.IsTrue(items.IsSavable); items.BeginSave((o4, e4) => { context.Assert.IsNull(e4.Error); context.Assert.IsNotNull(e4.NewObject); items = (ItemWithAsynchRuleList)e4.NewObject; context.Assert.AreEqual("DataPortal_Update", items[0].OperationResult); context.Assert.Success(); }); }; items[0].RuleField = "some value"; context.Assert.IsTrue(items.IsBusy); context.Assert.IsFalse(items.IsSavable); context.Complete(); }
public void ListTestSaveWhileBusy() { #if SILVERLIGHT DataPortal.ProxyTypeName = "Local"; #else System.Configuration.ConfigurationManager.AppSettings["CslaAutoCloneOnUpdate"] = "false"; #endif UnitTestContext context = GetContext(); ItemWithAsynchRuleList items = ItemWithAsynchRuleList.GetListWithItems(); items[0].RuleField = "some value"; context.Assert.IsTrue(items.IsBusy); context.Assert.IsFalse(items.IsSavable); items.BeginSave((o1, e1) => { var error = e1.Error as InvalidOperationException; context.Assert.IsNotNull(error); if (error != null) { context.Assert.IsTrue(error.Message.ToLower().Contains("busy")); } context.Assert.IsTrue(error.Message.ToLower().Contains("save")); context.Assert.Success(); }); context.Complete(); }