private void CreateBeanPathOnErrorMessages(XmlToModelResult result, object messageBean) { // would be nice to push this entire method into XmlToModelResult, but BeanUtil not visible from XmlToModelResult // (and moving classes or adding a dependency causes all sorts of problems) foreach (Hl7Error hl7Error in result.GetHl7Errors()) { string beanPath = BeanUtil.DescribeBeanPath(messageBean, hl7Error.GetPath()); hl7Error.SetBeanPath(beanPath); } }
public virtual XmlToModelResult MapToTeal(Hl7MessageSource hl7MessageSource) { if (hl7MessageSource.GetInteraction() != null) { Type messageBeanType = MessageBeanRegistry.GetInstance().GetInteractionBeanType(hl7MessageSource.GetMessageTypeKey()); object messageBean = BeanUtil.Instantiate <object>(messageBeanType); BeanWrapper wrapper = new BeanWrapper(messageBean); MapToTeal(hl7MessageSource, wrapper, null); hl7MessageSource.GetResult().SetMessageObject(messageBean); CreateBeanPathOnErrorMessages(hl7MessageSource.GetResult(), messageBean); } return(hl7MessageSource.GetResult()); }
public virtual void ShouldHandleComplexPathEndingInNullProperty() { string result = BeanUtil.DescribeBeanPath(this.testBean, "/MOCK_IN123456CA/theType/component/subject3/name"); Assert.AreEqual(PropertyPath.ToPath("MockMessageBean.type.name"), result); }
public virtual void ShouldHandleComplexPathWithoutMessageBean() { string result = BeanUtil.DescribeBeanPath(this.testBean, "theType/component/subject3/name"); Assert.AreEqual(PropertyPath.ToPath("MockMessageBean.type.name"), result); }
public virtual void ShouldHandleSimplePath() { string result = BeanUtil.DescribeBeanPath(this.testBean, "/MOCK_IN123456CA/theType"); Assert.AreEqual(PropertyPath.ToPath("MockMessageBean.type"), result); }
public virtual void ShouldHandlePathNotFound() { Assert.AreEqual(PropertyPath.ToPath("MockMessageBean"), BeanUtil.DescribeBeanPath(this.testBean, "/aNotFound/b/c")); }
public virtual void ShouldHandleEmptyPath() { Assert.AreEqual(string.Empty, BeanUtil.DescribeBeanPath(new object(), " ")); }
public virtual void ShouldHandleNullBean() { Assert.AreEqual(string.Empty, BeanUtil.DescribeBeanPath(null, "/a/b/c")); }