Exemplo n.º 1
0
 public void _04_GetNonExistingDocumentTypeFromIdTest()
 {
     try
     {
         Print.Started("_04_GetNonExistingDocumentTypeFromIdTest");
         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 = null;
         bool any = documentTypeCollection.TryGetDocumentType(Guid.NewGuid(), out documentTypeFromCollection);
         Assert.IsFalse(any);
         Assert.IsNull(documentTypeFromCollection);
     }
     finally
     {
         Print.Completed("_04_GetNonExistingDocumentTypeFromIdTest");
     }
 }
Exemplo n.º 2
0
 public void _02_InsertDocumentWithSameIdTest()
 {
     try
     {
         Print.Started("_02_InsertDocumentWithSameIdTest");
         string rootNameA     = "TestA";
         string rootNameB     = "TestB";
         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           documentTypeA          = new DocumentTypeConfig(rootNameA, rootNamespace, identifierDiscriminators);
         DocumentTypeConfig           documentTypeB          = new DocumentTypeConfig(rootNameB, rootNamespace, identifierDiscriminators);
         DocumentTypeCollectionConfig documentTypeCollection = new DocumentTypeCollectionConfig();
         documentTypeCollection.AddDocumentType(documentTypeA);
         documentTypeB.Id = documentTypeA.Id;
         Assert.Throws <DocumentAllreadyAddedException>(() => documentTypeCollection.AddDocumentType(documentTypeB));
     }
     finally
     {
         Print.Completed("_02_InsertDocumentWithSameIdTest");
     }
 }
Exemplo n.º 3
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");
     }
 }
Exemplo n.º 4
0
        public void _03_DocumentTypeEqualsOnParameters()
        {
            Print.Started("_03_SimpleDocumentTypeEqualsOnParameters");
            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 a = new DocumentTypeConfig(rootName, rootNamespace, identifierDiscriminators);
            DocumentTypeConfig b = new DocumentTypeConfig(rootName, rootNamespace, identifierDiscriminators);

            Assert.IsTrue(a.Equals(b));
            Print.Completed("_03_SimpleDocumentTypeEqualsOnParameters");
        }
Exemplo n.º 5
0
        public void _06_DocumentTypeNotEqualRootNamespaceAndId()
        {
            Print.Started("_06_DocumentTypeNotEqualRootNamespaceAndId");
            string rootName       = "Test";
            string rootNamespaceA = "http://oio.dk/testA";
            string rootNamespaceB = "http://oio.dk/testB";
            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 a = new DocumentTypeConfig(rootName, rootNamespaceA, identifierDiscriminators);
            DocumentTypeConfig b = new DocumentTypeConfig(rootName, rootNamespaceB, identifierDiscriminators);

            Assert.IsFalse(a.Equals(b));
            Print.Completed("_06_DocumentTypeNotEqualRootNamespaceAndId");
        }
Exemplo n.º 6
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");
     }
 }