/// <summary> /// Normalizes a workspace or resource collection's Atom title property value so that it matches the element's title annotation. /// </summary> /// <param name="payloadElement">The payload element to normalize</param> /// <param name="titlePropertyValue">The value of the payload element's title property</param> /// <param name="setPropertyValue">Delegate for setting the payload element's title property</param> private void NormalizeTitleValue(ODataPayloadElement payloadElement, string titlePropertyValue, Action <string> setPropertyValue) { XmlTreeAnnotation titleXmlTreeAnnotation = payloadElement.Annotations .OfType <XmlTreeAnnotation>() .SingleOrDefault(a => a.LocalName.Equals(TestAtomConstants.AtomTitleElementName)); if (titlePropertyValue != null) { if (titleXmlTreeAnnotation != null) { string titleAnnotationValue = titleXmlTreeAnnotation.PropertyValue; if (titleAnnotationValue == null) { titleXmlTreeAnnotation.PropertyValue = titlePropertyValue; } else { ExceptionUtilities.Assert(titlePropertyValue == titleAnnotationValue, "Title in workspace or resource collection has different values : Property=" + titlePropertyValue + ", Annotation=" + titleAnnotationValue); } } else { payloadElement.AtomTitle(titlePropertyValue, TestAtomConstants.AtomTextConstructTextKind); } } else if (titleXmlTreeAnnotation != null) { setPropertyValue(titleXmlTreeAnnotation.PropertyValue); } }