This project is read-only.

Another strange XAT thing.

Feb 3, 2012 at 5:51 AM

I have a helper method in my test:

        public ITestObject NewPerson (ITestObject iFam)
        {
               var type = TypeUtils.GetProxiedType (iFam.GetDomainObject ().GetType ());
               Assert.AreEqual (typeof (Family), type);

                var newPersonAc = iFam.GetAction ("Add New Member");
                newPersonAc.AssertIsVisible ().AssertIsEnabled ();
                var iPerson = newPersonAc.InvokeReturnObject ();
                iPerson.AssertCannotBeSaved ();
                var iSurname = iPerson.GetPropertyByName ("Surname").AssertIsVisible ().AssertIsModifiable ().AssertIsMandatory ();
                var iName = iPerson.GetPropertyByName ("First Name").AssertIsVisible ().AssertIsModifiable ().AssertIsMandatory ();
                iName.SetValue ("P-{0}".FormatI (NextTestValue));
                iPerson.AssertCanBeSaved ();

                iPerson.AssertCanBeSaved ();
                iPerson.Save ();
                iPerson.AssertCannotBeSaved ();

                return iPerson;
        }

When I call it once, all is good.

When I call it a second time, right after the first, on the same Family entity, I get the below error on the iPerson.Save ();

Test method XAT.BasicXAT.VerifyCorrectMenuPermissionsPerRole threw exception:
System.InvalidOperationException: The operation failed: The relationship could not be changed because one or more of the foreign-key properties is non-nullable. When a change is made to a relationship, the related foreign-key property is set to a null value. If the foreign-key does not support null values, a new relationship must be defined, the foreign-key property must be assigned another non-null value, or the unrelated object must be deleted.
TestCleanup method XAT.BasicXAT.Cleanup threw exception. System.InvalidOperationException: System.InvalidOperationException: The operation failed: The relationship could not be changed because one or more of the foreign-key properties is non-nullable. When a change is made to a relationship, the related foreign-key property is set to a null value. If the foreign-key does not support null values, a new relationship must be defined, the foreign-key property must be assigned another non-null value, or the unrelated object must be deleted..

Feb 3, 2012 at 8:44 AM

Since the error indicates violation of a database constraint, I suggest you debug into the test and look at the database immediately before and after the point of failure.