Exemplo n.º 1
0
        public virtual void TestLookupListLoaderConstructors()
        {
            XmlBusinessObjectLookupListLoader bollLoader = new XmlBusinessObjectLookupListLoader(new DtdLoader(), GetDefClassFactory());

            Assert.AreEqual(typeof(XmlBusinessObjectLookupListLoader), bollLoader.GetType());

            XmlDatabaseLookupListLoader dllLoader = new XmlDatabaseLookupListLoader(new DtdLoader(), GetDefClassFactory());

            Assert.AreEqual(typeof(XmlDatabaseLookupListLoader), dllLoader.GetType());
        }
        public void TestDatabaseLookupListWithClassDef()
        {
            XmlDatabaseLookupListLoader loader = new XmlDatabaseLookupListLoader(new DtdLoader(), GetDefClassFactory());

            MyBO.LoadDefaultClassDef();
            ILookupList def =
                loader.LoadLookupList(
                    @"<databaseLookupList sql=""Source"" class=""MyBO"" assembly=""Habanero.Test"" />");
            IDatabaseLookupList source = (IDatabaseLookupList)def;

            Assert.AreEqual("MyBO", source.ClassName);
            Assert.AreEqual("Habanero.Test", source.AssemblyName);
            Assert.AreEqual(10000, source.TimeOut);
        }
 public void TestDatabaseLookupListWithInvalidTimeout()
 {
     try
     {
         XmlDatabaseLookupListLoader loader = new XmlDatabaseLookupListLoader(new DtdLoader(), GetDefClassFactory());
         loader.LoadLookupList(
             @"<databaseLookupList sql=""Source"" timeout=""aaa"" />");
         Assert.Fail("Expected to throw an InvalidXmlDefinitionException");
     }
     //---------------Test Result -----------------------
     catch (InvalidXmlDefinitionException ex)
     {
         StringAssert.Contains("'databaseLookupList' element, an invalid integer was assigned to the 'timeout' attribute", ex.Message);
     }
 }