Beispiel #1
0
        public void ListTestSaveWhileNotBusyNetOnly()
        {
#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 = items.Save();
                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();
        }
Beispiel #2
0
        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();
        }
Beispiel #3
0
        public void ListTestSaveWhileBusyNetOnly()
        {
#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);
            bool gotError = false;
            try
            {
                items.Save();
            }
            catch (InvalidOperationException EX)
            {
                gotError = true;
            }
            context.Assert.IsTrue(gotError);
            context.Assert.Success();

            context.Complete();
        }
Beispiel #4
0
        public void ListTestSaveWhileNotBusy()
        {
            System.Configuration.ConfigurationManager.AppSettings["CslaAutoCloneOnUpdate"] = "false";
            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();
        }
Beispiel #5
0
        public void ListTestSaveWhileNotBusyNetOnly()
        {
            IDataPortal <ItemWithAsynchRuleList> dataPortal = _noCloneOnUpdateDIContext.CreateDataPortal <ItemWithAsynchRuleList>();

            TestResults.Reinitialise();

            UnitTestContext        context = GetContext();
            ItemWithAsynchRuleList items   = ItemWithAsynchRuleList.GetListWithItems(dataPortal);



            items[0].ValidationComplete += (o2, e2) =>
            {
                context.Assert.IsFalse(items.IsBusy);
                context.Assert.IsTrue(items.IsSavable);
                items = items.Save();
                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();
        }
Beispiel #6
0
        public void ListTestSaveWhileBusyNetOnly()
        {
            IDataPortal <ItemWithAsynchRuleList> dataPortal = _noCloneOnUpdateDIContext.CreateDataPortal <ItemWithAsynchRuleList>();

            TestResults.Reinitialise();

            UnitTestContext        context = GetContext();
            ItemWithAsynchRuleList items   = ItemWithAsynchRuleList.GetListWithItems(dataPortal);

            items[0].RuleField = "some value";
            context.Assert.IsTrue(items.IsBusy);
            context.Assert.IsFalse(items.IsSavable);
            bool gotError = false;

            try
            {
                items.Save();
            }
            catch (InvalidOperationException)
            {
                gotError = true;
            }
            context.Assert.IsTrue(gotError);
            context.Assert.Success();

            context.Complete();
        }
Beispiel #7
0
        public async Task ListTestSaveWhileBusy()
        {
            IDataPortal <ItemWithAsynchRuleList> dataPortal = _noCloneOnUpdateDIContext.CreateDataPortal <ItemWithAsynchRuleList>();

            TestResults.Reinitialise();

            UnitTestContext        context = GetContext();
            ItemWithAsynchRuleList items   = ItemWithAsynchRuleList.GetListWithItems(dataPortal);

            items[0].RuleField = "some value";
            context.Assert.IsTrue(items.IsBusy);
            context.Assert.IsFalse(items.IsSavable);

            try
            {
                await items.SaveAsync();
            }
            catch (Exception ex)
            {
                var error = ex as InvalidOperationException;
                context.Assert.IsNotNull(error);
                context.Assert.IsTrue(error.Message.ToLower().Contains("busy"));
                context.Assert.IsTrue(error.Message.ToLower().Contains("save"));
                context.Assert.Success();
            }
            context.Complete();
        }
Beispiel #8
0
        public void ListTestBusy()
        {
            System.Configuration.ConfigurationManager.AppSettings["CslaAutoCloneOnUpdate"] = "false";
            UnitTestContext        context = GetContext();
            ItemWithAsynchRuleList items   = ItemWithAsynchRuleList.GetListWithItems();

            items[0].RuleField = "some value";
            context.Assert.IsTrue(items.IsBusy);
            context.Assert.IsFalse(items.IsSavable);
            context.Assert.Success();
            context.Complete();
        }
Beispiel #9
0
        public void ListTestBusy()
        {
            IDataPortal <ItemWithAsynchRuleList> dataPortal = _noCloneOnUpdateDIContext.CreateDataPortal <ItemWithAsynchRuleList>();

            UnitTestContext        context = GetContext();
            ItemWithAsynchRuleList items   = ItemWithAsynchRuleList.GetListWithItems(dataPortal);

            items[0].RuleField = "some value";
            context.Assert.IsTrue(items.IsBusy);
            context.Assert.IsFalse(items.IsSavable);
            context.Assert.Success();
            context.Complete();
        }
Beispiel #10
0
        public void ListTestSaveWhileNotBusyNoActiveRuleNetOnly()
        {
            System.Configuration.ConfigurationManager.AppSettings["CslaAutoCloneOnUpdate"] = "false";
            UnitTestContext        context = GetContext();
            ItemWithAsynchRuleList items   = ItemWithAsynchRuleList.GetListWithItems();

            items[0].OperationResult = "something";
            context.Assert.IsFalse(items.IsBusy);
            context.Assert.IsTrue(items.IsSavable);
            items = items.Save();
            context.Assert.AreEqual("DataPortal_Update", items[0].OperationResult);
            context.Assert.Success();
            context.Complete();
        }
Beispiel #11
0
        public void ListTestBusy()
        {
#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);
            context.Assert.Success();
            context.Complete();
        }
Beispiel #12
0
        public void ListTestSaveWhileNotBusyNoActiveRuleNetOnly()
        {
            IDataPortal <ItemWithAsynchRuleList> dataPortal = _noCloneOnUpdateDIContext.CreateDataPortal <ItemWithAsynchRuleList>();

            UnitTestContext        context = GetContext();
            ItemWithAsynchRuleList items   = ItemWithAsynchRuleList.GetListWithItems(dataPortal);

            items[0].OperationResult = "something";
            context.Assert.IsFalse(items.IsBusy);
            context.Assert.IsTrue(items.IsSavable);
            items = items.Save();
            context.Assert.AreEqual("DataPortal_Update", items[0].OperationResult);
            context.Assert.Success();
            context.Complete();
        }
Beispiel #13
0
        public async Task ListTestSaveWhileBusy()
        {
            System.Configuration.ConfigurationManager.AppSettings["CslaAutoCloneOnUpdate"] = "false";
            UnitTestContext        context = GetContext();
            ItemWithAsynchRuleList items   = ItemWithAsynchRuleList.GetListWithItems();

            items[0].RuleField = "some value";
            context.Assert.IsTrue(items.IsBusy);
            context.Assert.IsFalse(items.IsSavable);

            try
            {
                await items.SaveAsync();
            }
            catch (Exception ex)
            {
                var error = ex as InvalidOperationException;
                context.Assert.IsNotNull(error);
                context.Assert.IsTrue(error.Message.ToLower().Contains("busy"));
                context.Assert.IsTrue(error.Message.ToLower().Contains("save"));
                context.Assert.Success();
            }
            context.Complete();
        }