Exemple #1
0
        public void DataPortalEvents()
        {
            Csla.DataPortal.DataPortalInvoke         += new Action <DataPortalEventArgs>(ClientPortal_DataPortalInvoke);
            Csla.DataPortal.DataPortalInvokeComplete += new Action <DataPortalEventArgs>(ClientPortal_DataPortalInvokeComplete);

            try
            {
                ApplicationContext.GlobalContext.Clear();
                DpRoot root = DpRoot.NewRoot();

                root.Data = "saved";
                Csla.ApplicationContext.GlobalContext.Clear();
                root = root.Save();

                Assert.IsTrue((bool)ApplicationContext.GlobalContext["dpinvoke"], "DataPortalInvoke not called");
                Assert.IsTrue((bool)ApplicationContext.GlobalContext["dpinvokecomplete"], "DataPortalInvokeComplete not called");
                Assert.IsTrue((bool)ApplicationContext.GlobalContext["serverinvoke"], "Server DataPortalInvoke not called");
                Assert.IsTrue((bool)ApplicationContext.GlobalContext["serverinvokecomplete"], "Server DataPortalInvokeComplete not called");
            }
            finally
            {
                Csla.DataPortal.DataPortalInvoke         -= new Action <DataPortalEventArgs>(ClientPortal_DataPortalInvoke);
                Csla.DataPortal.DataPortalInvokeComplete -= new Action <DataPortalEventArgs>(ClientPortal_DataPortalInvokeComplete);
            }
        }
Exemple #2
0
        public void DataPortalEvents()
        {
            IDataPortal <DpRoot> dataPortal = _testDIContext.CreateDataPortal <DpRoot>();

            // TODO: Not sure how to replicate this in Csla 6
            //dataPortal.DataPortalInvoke += new Action<DataPortalEventArgs>(ClientPortal_DataPortalInvoke);
            //dataPortal.DataPortalInvokeComplete += new Action<DataPortalEventArgs>(ClientPortal_DataPortalInvokeComplete);

            try
            {
                TestResults.Reinitialise();
                DpRoot root = dataPortal.Create(new DpRoot.Criteria());

                root.Data = "saved";
                TestResults.Reinitialise();
                root = root.Save();

                Assert.AreEqual("true", TestResults.GetResult("dpinvoke"), "DataPortalInvoke not called");
                Assert.AreEqual("true", TestResults.GetResult("dpinvokecomplete"), "DataPortalInvokeComplete not called");
                Assert.AreEqual("true", TestResults.GetResult("serverinvoke"), "Server DataPortalInvoke not called");
                Assert.AreEqual("true", TestResults.GetResult("serverinvokecomplete"), "Server DataPortalInvokeComplete not called");
            }
            finally
            {
                // TODO: Not sure how to replicate this in Csla 6
                //dataPortal.DataPortalInvoke -= new Action<DataPortalEventArgs>(ClientPortal_DataPortalInvoke);
                //dataPortal.DataPortalInvokeComplete -= new Action<DataPortalEventArgs>(ClientPortal_DataPortalInvokeComplete);
            }
        }