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"); }
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"); }
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"); }
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"); }
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"); }
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(); }
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"); }
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"); } }
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"); }