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