Esempio n. 1
0
 public void _01_AddRemoveDocumentTypeTest()
 {
     try
     {
         Print.Started("_01_AddRemoveDocumentTypeTest");
         string rootName      = "Test";
         string rootNamespace = "http://oio.dk/test";
         XPathDiscriminatorConfig           identifierDiscriminatorA = new XPathDiscriminatorConfig("//Test/Key", "A");
         XPathDiscriminatorConfig           identifierDiscriminatorB = new XPathDiscriminatorConfig("//Test/Key", "B");
         XpathDiscriminatorConfigCollection identifierDiscriminators = new XpathDiscriminatorConfigCollection();
         identifierDiscriminators.Add(identifierDiscriminatorA);
         identifierDiscriminators.Add(identifierDiscriminatorB);
         DocumentTypeConfig           documentType           = new DocumentTypeConfig(rootName, rootNamespace, identifierDiscriminators);
         DocumentTypeCollectionConfig documentTypeCollection = new DocumentTypeCollectionConfig();
         documentTypeCollection.AddDocumentType(documentType);
         DocumentTypeConfig documentTypeFromCollection = documentTypeCollection.GetDocumentType(rootName, rootNamespace, identifierDiscriminators);
         Assert.IsTrue(documentTypeFromCollection.Equals(documentType));
         documentTypeCollection.RemoveDocumentType(documentTypeFromCollection);
         documentTypeFromCollection = null;
         bool anyDocument = documentTypeCollection.TryGetDocumentType(rootName, rootNamespace, identifierDiscriminators, out documentTypeFromCollection);
         Assert.IsFalse(anyDocument);
     }
     catch (Exception)
     {
         // easy debug
     }
     finally
     {
         Print.Completed("_01_AddRemoveDocumentTypeTest");
     }
 }
Esempio n. 2
0
 public void _07_GetNonExistingDocumentTypeFromParameters()
 {
     try
     {
         Print.Started("_07_GetNonExistingDocumentTypeFromParameters");
         string rootName      = "TestA";
         string rootNamespace = "http://oio.dk/test";
         XPathDiscriminatorConfig           identifierDiscriminatorA = new XPathDiscriminatorConfig("//Test/Key", "A");
         XPathDiscriminatorConfig           identifierDiscriminatorB = new XPathDiscriminatorConfig("//Test/Key", "B");
         XpathDiscriminatorConfigCollection identifierDiscriminators = new XpathDiscriminatorConfigCollection();
         identifierDiscriminators.Add(identifierDiscriminatorA);
         identifierDiscriminators.Add(identifierDiscriminatorB);
         DocumentTypeConfig           documentType           = new DocumentTypeConfig(rootName, rootNamespace, identifierDiscriminators);
         DocumentTypeCollectionConfig documentTypeCollection = new DocumentTypeCollectionConfig();
         documentTypeCollection.AddDocumentType(documentType);
         Assert.Throws <NoDocumentTypeFoundFromParametersException>(() => documentTypeCollection.GetDocumentType("TestB", rootNamespace, identifierDiscriminators));
     }
     finally
     {
         Print.Completed("_07_GetNonExistingDocumentTypeFromParameters");
     }
 }