Ejemplo n.º 1
0
        private void Bug514988(OpenXmlValidator validator)
        {
            var paragraph = new Paragraph();

            paragraph.RsidParagraphAddition = new HexBinaryValue();
            OpenXmlAttribute rsidR   = paragraph.GetAttribute("rsidR", paragraph.NamespaceUri);
            OpenXmlAttribute newattr = new OpenXmlAttribute(rsidR.LocalName, rsidR.NamespaceUri, "0102");

            paragraph.SetAttribute(newattr);
            var errors = new OpenXmlValidator().Validate(paragraph);

            Assert.Single(errors);
            Assert.Equal(ValidationErrorType.Schema, errors.First().ErrorType);
            Assert.Equal("Sch_AttributeValueDataTypeDetailed", errors.First().Id);
            Assert.Equal("The attribute 'http://schemas.openxmlformats.org/wordprocessingml/2006/main:rsidR' has invalid value '0102'. The actual length according to data type 'hexBinary' is not equal to the specified length. The expected length is 4.", errors.First().Description);
        }