コード例 #1
0
        public void TestInvalidConfiguration()
        {
            VelocityEngineFactory velocityEngineFactory = new VelocityEngineFactory();

            velocityEngineFactory.PreferFileSystemAccess = false;
            VelocityEngine velocityEngine = null;

            try {
                velocityEngineFactory.CreateVelocityEngine();
                throw new TestException(
                          "Should not be able to construct VelocityEngineFactory with SpringResourceLoader and no path");
            } catch (ArgumentException) {
                Assert.IsNull(velocityEngine, "velocityEngine should be null");
            }

            // no resource loader with spring
            velocityEngineFactory = new VelocityEngineFactory();
            velocityEngineFactory.ResourceLoader         = null;
            velocityEngineFactory.PreferFileSystemAccess = false;
            try {
                velocityEngineFactory.CreateVelocityEngine();
                throw new TestException(
                          "Should not be able to construct VelocityEngineFactory with null ResourceLoader");
            } catch (ArgumentException) {
                Assert.IsNull(velocityEngine, "velocityEngine should be null");
            }

            // no resource loader path with spring
            velocityEngineFactory = new VelocityEngineFactory();
            velocityEngineFactory.ResourceLoaderPaths    = new List <string>();
            velocityEngineFactory.PreferFileSystemAccess = false;
            try {
                velocityEngineFactory.CreateVelocityEngine();
                throw new TestException(
                          "Should not be able to construct VelocityEngineFactory with empty resource loader path list");
            } catch (ArgumentException) {
                Assert.IsNull(velocityEngine, "velocityEngine should be null");
            }
        }
コード例 #2
0
        public void TestInvalidConfiguration() {
            VelocityEngineFactory velocityEngineFactory = new VelocityEngineFactory();
            velocityEngineFactory.PreferFileSystemAccess = false;
            VelocityEngine velocityEngine = null;
            try {
                velocityEngineFactory.CreateVelocityEngine();
                throw new TestException(
                    "Should not be able to construct VelocityEngineFactory with SpringResourceLoader and no path");
            } catch (ArgumentException) {
                Assert.IsNull(velocityEngine, "velocityEngine should be null");
            }

            // no resource loader with spring
            velocityEngineFactory = new VelocityEngineFactory();
            velocityEngineFactory.ResourceLoader = null;
            velocityEngineFactory.PreferFileSystemAccess = false;
            try {
                velocityEngineFactory.CreateVelocityEngine();
                throw new TestException(
                    "Should not be able to construct VelocityEngineFactory with null ResourceLoader");
            } catch (ArgumentException) {
                Assert.IsNull(velocityEngine, "velocityEngine should be null");
            }

            // no resource loader path with spring
            velocityEngineFactory = new VelocityEngineFactory();
            velocityEngineFactory.ResourceLoaderPaths = new List<string>();
            velocityEngineFactory.PreferFileSystemAccess = false;
            try {
                velocityEngineFactory.CreateVelocityEngine();
                throw new TestException(
                    "Should not be able to construct VelocityEngineFactory with empty resource loader path list");
            } catch (ArgumentException) {
                Assert.IsNull(velocityEngine, "velocityEngine should be null");
            }
        }