protected override EntityName ParseNode(XmlNode node, XmlToModelResult xmlToModelResult) { OrganizationName result = new OrganizationName(); XmlNodeList childNodes = node.ChildNodes; foreach (XmlNode childNode in new XmlNodeListIterable(childNodes)) { if (childNode.NodeType == System.Xml.XmlNodeType.Text) { string value = childNode.Value; result.AddNamePart(new EntityNamePart(value)); } else { if (childNode is XmlElement) { XmlElement element = (XmlElement)childNode; string name = NodeUtil.GetLocalOrTagName(element); string value = GetTextValue(element, xmlToModelResult); result.AddNamePart(new EntityNamePart(value, GetOrganizationNamePartType(name))); } } } return(result); }
public virtual void TestFormatValueOrganizationName() { EnPropertyFormatter formatter = new EnPropertyFormatter(); OrganizationName name = new OrganizationName(); name.AddNamePart(new EntityNamePart("prefix", OrganizationNamePartType.PREFIX)); name.AddNamePart(new EntityNamePart("Organization")); Assert.AreEqual("<x xsi:type=\"ON\"><prefix>prefix</prefix>Organization</x>", formatter.Format(GetContext("x"), new ENImpl <EntityName>(name)).Trim(), "OrganizationName uses ON formatter"); }
public virtual void TestFormatValueNonNullMultipleNameParts() { OnPropertyFormatter formatter = new OnPropertyFormatter(); OrganizationName organizationName = new OrganizationName(); organizationName.AddNamePart(new EntityNamePart("prefix", OrganizationNamePartType.PREFIX)); organizationName.AddNamePart(new EntityNamePart("Organization")); organizationName.AddNamePart(new EntityNamePart(",", OrganizationNamePartType.DELIMITER)); organizationName.AddNamePart(new EntityNamePart("Inc", OrganizationNamePartType.SUFFIX)); string result = formatter.Format(GetContext("name"), new ONImpl(organizationName)); Assert.AreEqual("<name><prefix>prefix</prefix>Organization<delimiter>,</delimiter><suffix>Inc</suffix></name>", result.Trim (), "something in text node with goofy sub nodes"); }
private Custodian CreateCustodian() { EntityNamePart namePart = new EntityNamePart("Community Health and Hospitals"); OrganizationName name = new OrganizationName(); name.AddNamePart(namePart); CustodianOrganization organization = new CustodianOrganization(); organization.Id.Add(new Identifier("2.16.840.1.113883.4.6", "99999999")); organization.Name = name; organization.Telecom = CreateTelecom("555-555-1002", Ca.Infoway.Messagebuilder.Domainvalue.Basic.TelecommunicationAddressUse.WORKPLACE); organization.Addr = CreateAddress("1002 Healthcare Drive", "Portland", "OR", "99123", "US"); AssignedCustodian assignedCustodian = new AssignedCustodian(); assignedCustodian.RepresentedCustodianOrganization = organization; Custodian custodian = new Custodian(); custodian.AssignedCustodian = assignedCustodian; return(custodian); }
public virtual void TestFormatValueNonNull() { OnPropertyFormatter formatter = new OnPropertyFormatter(); OrganizationName organizationName = new OrganizationName(); organizationName.AddNamePart(new EntityNamePart("Organization")); string result = formatter.Format(GetContext("name"), new ONImpl(organizationName)); Assert.AreEqual("<name>Organization</name>", result.Trim(), "something in text node"); }
public virtual void TestFormatValueReservedXmlChars() { OnPropertyFormatter formatter = new OnPropertyFormatter(); OrganizationName organizationName = new OrganizationName(); organizationName.AddNamePart(new EntityNamePart("<cats think they're > humans & dogs 99% of the time/>")); string result = formatter.Format(GetContext("name"), new ONImpl(organizationName)); Assert.AreEqual("<name><cats think they're > humans & dogs 99% of the time/></name>".Trim(), result.Trim (), "something in text node"); }
public virtual void TestFormatValueNonNull() { EnR2PropertyFormatter formatter = new EnR2PropertyFormatter(); OrganizationName organizationName = new OrganizationName(); organizationName.AddNamePart(new EntityNamePart("Organization")); string result = formatter.Format(GetContext("name", "ON"), new ONImpl(organizationName)); Assert.IsTrue(this.result.IsValid()); AssertXml("something in text node", "<name>Organization</name>", result, true); }
public virtual void TestFormatValueReservedXmlChars() { EnR2PropertyFormatter formatter = new EnR2PropertyFormatter(); OrganizationName organizationName = new OrganizationName(); organizationName.AddNamePart(new EntityNamePart("<cats think they're > humans & dogs 99% of the time/>")); string result = formatter.Format(GetContext("name", "ON"), new ONImpl(organizationName)); Assert.IsTrue(this.result.IsValid()); AssertXml("something in text node", "<name><cats think they're > humans & dogs 99% of the time/></name>" , result, true); }
public virtual void TestOrganizationNameEquals() { OrganizationName orgName1 = new OrganizationName(); orgName1.AddUse(Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNameUse.LEGAL); orgName1.AddNamePart(new EntityNamePart("aName", OrganizationNamePartType.PREFIX, Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNamePartQualifier .LEGALSTATUS)); OrganizationName orgName2 = new OrganizationName(); orgName2.AddUse(Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNameUse.LEGAL); orgName2.AddNamePart(new EntityNamePart("aName", OrganizationNamePartType.PREFIX, Ca.Infoway.Messagebuilder.Domainvalue.Basic.EntityNamePartQualifier .LEGALSTATUS)); Assert.AreEqual(orgName1, orgName2); }