예제 #1
0
        public void MandatoryMandatory_1a(Store store)
        {
            myTestServices.LogValidationErrors("Start with no Error");
            ORMModel            model      = store.ElementDirectory.FindElements <ORMModel>()[0];
            Role                role_A     = (Role)store.ElementDirectory.GetElement(new Guid("FA2156EE-8612-47F3-8DB8-861814BAD997"));
            Role                role_B     = (Role)store.ElementDirectory.GetElement(new Guid("7DD25522-062E-4134-8B7A-F453FD979281"));
            MandatoryConstraint constraint = (MandatoryConstraint)model.ConstraintsDictionary.GetElement("InclusiveOrConstraint1").SingleElement;

            myTestServices.LogMessage("Introducing error via creating additional implied mandatory constraint");
            using (Transaction t = store.TransactionManager.BeginTransaction("Add Mandatory Costraint"))
            {
                role_A.IsMandatory = true;
                t.Commit();
            }
            myTestServices.LogValidationErrors("Error Received. Proceed to removal via removing the other Mandatory Constraint");
            using (Transaction t = store.TransactionManager.BeginTransaction("Remove a Mandatory Costraint"))
            {
                constraint.Delete();
                t.Commit();
            }
            myTestServices.LogValidationErrors("Error is removed.");
        }
예제 #2
0
        public void MandatoryMandatory_1b(Store store)
        {
            myTestServices.LogValidationErrors("Start with one Implication Error");
            ORMModel            model        = store.ElementDirectory.FindElements <ORMModel>()[0];
            MandatoryConstraint constraint_1 = (MandatoryConstraint)model.ConstraintsDictionary.GetElement("InclusiveOrConstraint1").SingleElement;
            MandatoryConstraint constraint_2 = (MandatoryConstraint)model.ConstraintsDictionary.GetElement("InclusiveOrConstraint2").SingleElement;

            using (Transaction t = store.TransactionManager.BeginTransaction("Remove a Mandatory Costraint"))
            {
                constraint_1.Delete();
                t.Commit();
            }
            myTestServices.LogValidationErrors("Error is removed with removal of a Constraint");
            myTestServices.LogValidationErrors("Undo to bring to initial condition");
            store.UndoManager.Undo();

            myTestServices.LogValidationErrors("Proceed to remove the other Mandatory Constraint");
            using (Transaction t = store.TransactionManager.BeginTransaction("Remove a Mandatory Costraint"))
            {
                constraint_2.Delete();
                t.Commit();
            }
            myTestServices.LogValidationErrors("All Errors Removed");
        }