public void GetAssociatedObject()
        {
            key1.SetValue("NakedObjects.SystemTest.ObjectFinderGuid.Customer|0c1ced04-7016-11e0-9c44-78544824019b");
            payee1.AssertIsNotEmpty();
            payee1.ContentAsObject.GetPropertyByName("Guid").AssertValueIsEqual("0c1ced04-7016-11e0-9c44-78544824019b");

            payee1.ClearObject();

            key1.SetValue("NakedObjects.SystemTest.ObjectFinderGuid.Customer|3d9d6ca0-7016-11e0-b12a-9e544824019b");
            payee1.AssertIsNotEmpty();
            payee1.ContentAsObject.GetPropertyByName("Guid").AssertValueIsEqual("3d9d6ca0-7016-11e0-b12a-9e544824019b");
        }
        public void GetAssociatedObject()
        {
            key1.SetValue("NakedObjects.SystemTest.ObjectFinderSingleKey.Customer|1");
            payee1.AssertIsNotEmpty();
            payee1.ContentAsObject.GetPropertyByName("Id").AssertValueIsEqual("1");

            payee1.ClearObject();

            key1.SetValue("NakedObjects.SystemTest.ObjectFinderSingleKey.Customer|2");
            payee1.AssertIsNotEmpty();
            payee1.ContentAsObject.GetPropertyByName("Id").AssertValueIsEqual("2");
        }
Example #3
0
        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();
        }
Example #4
0
        public virtual void SetPolymorphicPropertyOnTransientObject(string roleObjectType)
        {
            ITestObject transPayment = GetTestService("Polymorphic Payments").GetAction("New Instance").InvokeReturnObject();

            ITestObject customer1 = GetTestService("Customer As Payees").GetAction("New Instance").InvokeReturnObject().Save();
            string      cusId     = customer1.GetPropertyByName("Id").Title;

            ITestProperty payeeProp     = transPayment.GetPropertyByName("Payee");
            ITestProperty payeeLinkProp = transPayment.GetPropertyByName("Payee Link").AssertIsUnmodifiable().AssertIsEmpty();

            payeeProp.SetObject(customer1);
            transPayment.Save();
            ITestObject   payeeLink      = payeeLinkProp.AssertIsNotEmpty().ContentAsObject;
            ITestProperty associatedType = payeeLink.GetPropertyByName("Associated Role Object Type").AssertIsUnmodifiable();

            associatedType.AssertValueIsEqual(roleObjectType);
            ITestProperty associatedId = payeeLink.GetPropertyByName("Associated Role Object Id").AssertIsUnmodifiable();

            associatedId.AssertValueIsEqual(cusId);
        }