Example #1
0
        public void CheckCanDeleteWithNoPrevents()
        {
            TestBO1 testBO1 = PopulateObjectWithNoPrevents();
            string  result;
            bool    canDelete = DeleteHelper.CheckCanDelete(testBO1, out result);

            Assert.IsTrue(canDelete, "Should prevent delete.");
            Assert.AreEqual("", result);
        }
Example #2
0
        public void CheckCanDeleteWithTieredPrevents_InPersisted()
        {
            TestBO1 testBO1 = PopulateObjectWithTieredPrevents_InPersisted();
            string  result;
            bool    canDelete = DeleteHelper.CheckCanDelete(testBO1, out result);

            Assert.IsFalse(canDelete, "Should prevent delete.");
            StringAssert.Contains("Cannot delete this 'TestBO1' ", result);
            StringAssert.Contains("for the following reasons:" + Environment.NewLine +
                                  "There are 9 objects related through the 'MyBO2.MyBO3.MyBO4.MyPreventBO5' relationship that need to be deleted first." + Environment.NewLine +
                                  "There are 7 objects related through the 'MyBO2.MyPreventBO3' relationship that need to be deleted first." + Environment.NewLine +
                                  "There are 1 objects related through the 'MyBO2.MyBO3.MyBO4.MyBO5.MyBO6.MyPreventBO7' relationship that need to be deleted first.",
                                  result);
        }
Example #3
0
        public void CheckCanDeleteWithSomePrevents_InPersisted()
        {
            //-----------Setup test---------------------------------
            TestBO1 testBO1 = PopulateObjectWithSomePreventsInPersisted();
            string  result;
            //-----------Execute test-------------------------------
            bool canDelete = DeleteHelper.CheckCanDelete(testBO1, out result);

            //-----------Assert Result------------------------------
            Assert.IsFalse(canDelete, "Should prevent delete.");
            StringAssert.Contains("Cannot delete this 'TestBO1' ", result);
            StringAssert.Contains("for the following reasons:" + Environment.NewLine +
                                  "There are 7 objects related through the 'MyBO2.MyPreventBO3' relationship that need to be deleted first.",
                                  result);
        }