public void ChangeAssociatedObjectType() { payee1.SetObject(customer1); payee1.ClearObject(); payee1.SetObject(supplier1); Assert.AreEqual(payee1.ContentAsObject, supplier1); key1.AssertValueIsEqual("NakedObjects.SystemTest.ObjectFinderSingleKey.Supplier|1"); }
public void ChangeAssociatedObjectType() { payee1.SetObject(customer1); payee1.ClearObject(); payee1.SetObject(supplier1); Assert.AreEqual(payee1.ContentAsObject, supplier1); key1.AssertValueIsEqual("NakedObjects.SystemTest.ObjectFinderGuid.Supplier|89bc90ec-7017-11e0-a08c-57564824019b"); }
public virtual void ChangePolymorphicPropertyOnPersistentObject(string customerType, string supplierType) { var payment2 = FindById <PolymorphicPayment>(3); var customer1 = FindById <CustomerAsPayee>(1); string cusId = customer1.GetPropertyByName("Id").Title; ITestProperty payeeProp = payment2.GetPropertyByName("Payee"); ITestProperty payeeLinkProp = payment2.GetPropertyByName("Payee Link").AssertIsUnmodifiable(); payeeProp.SetObject(customer1); ITestObject payeeLink = payeeLinkProp.AssertIsNotEmpty().ContentAsObject; ITestProperty associatedType = payeeLink.GetPropertyByName("Associated Role Object Type").AssertIsUnmodifiable(); associatedType.AssertValueIsEqual(customerType); ITestProperty associatedId = payeeLink.GetPropertyByName("Associated Role Object Id").AssertIsUnmodifiable(); associatedId.AssertValueIsEqual(cusId); ITestObject sup1 = GetTestService("Supplier As Payees").GetAction("New Instance").InvokeReturnObject().Save(); string supId = sup1.GetPropertyByName("Id").Title; payeeProp.SetObject(sup1); associatedType.AssertValueIsEqual(supplierType); associatedId.AssertValueIsEqual(supId); payeeProp.ClearObject(); payeeLinkProp.AssertIsEmpty(); payeeProp.AssertIsEmpty(); }