public void ValidatePart(OpenXmlPart part) { var data = GetConstraintData(part); Assert.Same(part.GetPartMetadata().PartConstraints, part.GetPartMetadata().PartConstraints); Assert.Same(part.GetPartMetadata().DataPartReferenceConstraints, part.GetPartMetadata().DataPartReferenceConstraints); if (!part.GetPartMetadata().PartConstraints.Any()) { Assert.Same(PartConstraintCollection.Instance, part.GetPartMetadata().PartConstraints); } if (!part.GetPartMetadata().DataPartReferenceConstraints.Any()) { Assert.Same(PartConstraintCollection.Instance, part.GetPartMetadata().DataPartReferenceConstraints); } Assert.Equal(data.IsContentTypeFixed, part.IsContentTypeFixed); Assert.Equal(data.RelationshipType, part.RelationshipType); Assert.Equal(data.TargetFileExtension, part.TargetFileExtension); Assert.Equal(data.TargetName, part.TargetName); Assert.Equal(data.TargetPath, part.TargetPath); if (part.IsContentTypeFixed) { Assert.Equal(data.ContentType, part.ContentType); } #if DEBUG _output.WriteObjectToTempFile(part.GetPartMetadata().DataPartReferenceConstraints); #endif AssertDictionary(data.DataParts, part.GetPartMetadata().DataPartReferenceConstraints); #if DEBUG _output.WriteObjectToTempFile(data.Parts); _output.WriteObjectToTempFile(part.GetPartMetadata().PartConstraints); #endif AssertDictionary(data.Parts, part.GetPartMetadata().PartConstraints); }