/// <summary> /// Adds a new section to the document collection /// </summary> /// <param name="path">Path of the corresponding XML document described by the section</param> /// <param name="estimatedDocumentCount">Estimated number of content type entries. Default is 10. This number is a performance measure</param> /// <returns>RelationshipSection object</returns> public RelationshipSection AddSection(string path, int estimatedDocumentCount = 10) { RelationshipSection section = new RelationshipSection(path, this.RelationshipXmlns, this.ContentTypes, estimatedDocumentCount); this.RelationshipSections.Add(section); return(section); }
public void ConstructorTest(string path, string xmlns, string expectedPath, string expectedRelationship) { XmlContentTypes reference = new XmlContentTypes("contentTypeNS"); RelationshipSection section = new RelationshipSection(path, xmlns, reference); Assert.Multiple(() => { Assert.IsNotNull(section.Documents); Assert.AreEqual(section.Documents.Count, 0); Assert.AreEqual(section.Relationships.GetXmlString(), expectedRelationship); Assert.AreEqual(section.Path, expectedPath); }); }
public void AddDocumentTest(string xmlns, string id, string type, string targetPath, string contentType, string encoding, bool?standalone, string expectedDocumentString, string expectedRelationShipString) { XmlContentTypes reference = new XmlContentTypes("contentTypeNS"); RelationshipSection section = new RelationshipSection("/path", xmlns, reference); section.AddDocument(id, type, targetPath, contentType, "/basePath", 10, encoding, standalone); Assert.Multiple(() => { Assert.AreEqual(section.Documents.Count, 1); Assert.AreEqual(section.Documents[0].GetXmlString(), expectedDocumentString); Assert.AreEqual(section.Relationships.GetXmlString(), expectedRelationShipString); }); }
public void AddDocumentTest2(string idString, string typeString, string targetPathString, int expectedCount, string expectedRelationShipString) { XmlContentTypes reference = new XmlContentTypes("contentTypeNS"); RelationshipSection section = new RelationshipSection("/path", "ns1", reference); string[] ids = TestUtils.SplitValues(idString, '|'); string[] types = TestUtils.SplitValues(typeString, '|'); string[] targetPaths = TestUtils.SplitValues(targetPathString, '|'); for (int i = 0; i < expectedCount; i++) { section.AddDocument(ids[i], types[i], targetPaths[i], "contentType", "/basePath", 10, "UTF-8", true); } Assert.Multiple(() => { Assert.AreEqual(section.Documents.Count, expectedCount); Assert.AreEqual(section.Relationships.GetXmlString(), expectedRelationShipString); }); }