コード例 #1
0
        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");
        }
コード例 #3
0
 public virtual void ObjectWithSimpleToString() {
     rep = GetTestService("Object2s");
     obj = rep.GetAction("New Instance").InvokeReturnObject();
     prop1 = obj.GetPropertyByName("Prop1");
     prop1.SetValue("Bar");
     obj.AssertTitleEquals("Bar");
     obj.Save();
     obj.AssertTitleEquals("Bar");
 }
コード例 #4
0
 public virtual void ObjectWithTitleAttributeOnString() {
     rep = GetTestService("Object1s");
     obj = rep.GetAction("New Instance").InvokeReturnObject();
     obj.AssertTitleEquals("Untitled Object1");
     prop1 = obj.GetPropertyByName("Prop1");
     prop1.SetValue("Foo");
     obj.AssertTitleEquals("Foo");
     obj.Save();
     obj.AssertTitleEquals("Foo");
 }
コード例 #5
0
 public virtual void TitleMethod() {
     rep = GetTestService("Object4s");
     obj = rep.GetAction("New Instance").InvokeReturnObject();
     obj.AssertTitleEquals("Untitled Object4");
     prop1 = obj.GetPropertyByName("Prop1");
     prop1.SetValue("Foo");
     obj.AssertTitleEquals("Foo");
     obj.Save();
     obj.AssertTitleEquals("Foo");
 }
コード例 #6
0
 public virtual void CMaskOnDecimalProperty() {
     obj = NewTestObject<Object2>();
     prop1 = obj.GetPropertyByName("Prop1");
     prop1.SetValue("32.70");
     var dom = (Object2) obj.GetDomainObject();
     StringAssert.Equals("32.7", dom.Prop1.ToString());
     StringAssert.Equals("32.70", prop1.Content.Title);
     StringAssert.Equals("£32.70", prop1.Title);
     prop1.AssertTitleIsEqual("£32.70");
     prop1.AssertValueIsEqual("32.70");
 }
コード例 #7
0
            private void SetupForClearTests(out ITestProperty prop0, out ITestProperty prop1) {
                ITestObject obj = NewTestObject<Object1>();
                prop0 = obj.GetPropertyByName("Prop0");
                prop1 = obj.GetPropertyByName("Prop1");

                prop0.AssertIsEmpty();
                prop1.AssertIsEmpty();

                prop1.SetValue("Foo");
                prop1.AssertValueIsEqual("Foo");
                prop0.AssertIsEmpty();
            }
コード例 #8
0
 public virtual void DMaskOnDateProperty() {
     obj = NewTestObject<Object1>();
     prop1 = obj.GetPropertyByName("Prop1");
     prop1.SetValue("23/09/2009 11:34:50");
     prop2 = obj.GetPropertyByName("Prop2");
     prop2.SetValue("23/09/2009 11:34:50");
     var dom = (Object1) obj.GetDomainObject();
     StringAssert.Equals("23/09/2009 11:34:50", dom.Prop1.ToString());
     StringAssert.Equals("23/09/2009 11:34:50", prop1.Content.Title);
     StringAssert.Equals("23/09/2009 11:34:50", dom.Prop2.ToString());
     StringAssert.Equals("23/09/2009", prop2.Content.Title);
     prop1.AssertTitleIsEqual("23/09/2009 11:34:50");
     prop1.AssertValueIsEqual("23/09/2009 11:34:50");
     prop2.AssertTitleIsEqual("23/09/2009");
     prop2.AssertValueIsEqual("23/09/2009 11:34:50");
 }
コード例 #9
0
        public virtual void ExceptionInUpdatedCausesWholeTransactionToFail()
        {
            ITestAction   qs   = GetTestService(typeof(SimpleRepository <Qux1>)).GetAction("All Instances");
            ITestObject   q    = qs.InvokeReturnCollection().AssertCountIs(1).ElementAt(0);
            ITestProperty name = q.GetPropertyByName("Name");

            name.AssertValueIsEqual("Qux 1");
            try {
                triggerFail = true;
                name.SetValue("yyy");
            }
            catch {
                triggerFail = false;
                q.Refresh();
                q    = qs.InvokeReturnCollection().AssertCountIs(1).ElementAt(0);
                name = q.GetPropertyByName("Name");
                name.AssertValueIsEqual("Qux 1");
            }
        }
コード例 #10
0
            public virtual void TitleAttributeTakesPrecedenceOverTitleMethod() {
                rep = GetTestService("Object6s");
                obj = rep.GetAction("New Instance").InvokeReturnObject();
                var dom = (Object6) obj.GetDomainObject();
                StringAssert.Equals("Bar", dom.ToString());
                StringAssert.Equals("Hex", dom.Title());
                obj.AssertTitleEquals("Untitled Object6");
                prop1 = obj.GetPropertyByName("Prop1");
                prop1.SetValue("Foo");
                obj.AssertTitleEquals("Foo");
                obj.Save();
                obj.AssertTitleEquals("Foo");

           
            }