public void PDFGeneratorSettingsConstructorTest()
        {
            Type literaltype                  = typeof(Scryber.Components.TextLiteral);
            Type templategenerator            = typeof(Scryber.Data.ParsableTemplateGenerator);
            Type templateinstance             = typeof(Scryber.Data.TemplateInstance);
            PDFReferenceResolver  resolver    = new PDFReferenceResolver(this.ShimResolver);
            ParserConformanceMode conformance = ParserConformanceMode.Lax;
            ParserLoadType        loadtype    = ParserLoadType.ReflectiveParser;
            PDFTraceLog           log         = new Scryber.Logging.DoNothingTraceLog(TraceRecordLevel.Off);
            PDFPerformanceMonitor mon         = new PDFPerformanceMonitor(true);

            Mocks.MockControllerClass controller = new Mocks.MockControllerClass();

            PDFGeneratorSettings target = new PDFGeneratorSettings(literaltype, templategenerator, templateinstance, resolver, conformance, loadtype, log, mon, controller);

            Assert.IsNotNull(target);
            Assert.AreSame(literaltype, target.TextLiteralType);
            Assert.AreSame(templategenerator, target.TempateGeneratorType);
            Assert.AreSame(resolver, target.Resolver);
            Assert.AreEqual(conformance, target.ConformanceMode);
            Assert.AreEqual(loadtype, target.LoadType);
            Assert.AreSame(log, target.TraceLog);
            Assert.AreSame(mon, target.PerformanceMonitor);
            Assert.AreSame(controller, target.Controller);
            Assert.AreEqual(controller.GetType(), target.ControllerType);
        }
Esempio n. 2
0
        //
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        //
        // support methods
        //


        private PDFGeneratorSettings GetSettings()
        {
            Type literaltype                  = typeof(Scryber.Components.TextLiteral);
            Type templategenerator            = typeof(Scryber.Data.ParsableTemplateGenerator);
            Type templateinstance             = typeof(Scryber.Data.TemplateInstance);
            PDFReferenceResolver  resolver    = new PDFReferenceResolver(this.ShimResolver);
            ParserConformanceMode conformance = ParserConformanceMode.Lax;
            ParserLoadType        loadtype    = ParserLoadType.ReflectiveParser;
            PDFTraceLog           log         = new Scryber.Logging.DoNothingTraceLog(TraceRecordLevel.Off);
            PDFPerformanceMonitor perfmon     = new PDFPerformanceMonitor(true);
            PDFGeneratorSettings  settings    = new PDFGeneratorSettings(literaltype, templategenerator, templateinstance, resolver, conformance, loadtype, log, perfmon, null);

            return(settings);
        }
        public void ConformanceModeTest()
        {
            Type literaltype                  = typeof(Scryber.Components.TextLiteral);
            Type templategenerator            = typeof(Scryber.Data.ParsableTemplateGenerator);
            Type templateinstance             = typeof(Scryber.Data.TemplateInstance);
            PDFReferenceResolver  resolver    = new PDFReferenceResolver(this.ShimResolver);
            ParserConformanceMode conformance = ParserConformanceMode.Lax;
            ParserLoadType        loadtype    = ParserLoadType.ReflectiveParser;
            PDFTraceLog           log         = new Scryber.Logging.DoNothingTraceLog(TraceRecordLevel.Off);
            PDFPerformanceMonitor mon         = new PDFPerformanceMonitor(true);
            PDFGeneratorSettings  target      = new PDFGeneratorSettings(literaltype, templategenerator, templateinstance, resolver, conformance, loadtype, log, mon, null);

            Assert.AreEqual(conformance, target.ConformanceMode);

            ParserConformanceMode expected = ParserConformanceMode.Strict;
            ParserConformanceMode actual;

            target.ConformanceMode = expected;
            actual = target.ConformanceMode;
            Assert.AreEqual(expected, actual);
        }
Esempio n. 4
0
        public PDFGeneratorSettings(Type literaltype, Type templategenerator, Type templateinstance,
                                    PDFReferenceResolver resolver, ParserConformanceMode conformance, ParserLoadType loadtype,
                                    PDFTraceLog log, PDFPerformanceMonitor perfmon, object controllerInstance)
        {
            this._textLiteralType      = literaltype;
            this._tempateGenType       = templategenerator;
            this._templateinstanceType = templateinstance;
            this._resolver             = resolver;
            this._conformance          = conformance;
            this._loadtype             = loadtype;
            this._log                = log;
            this._perfmon            = perfmon;
            this._controllerInstance = controllerInstance;
            this._controllerType     = (null == controllerInstance) ? null : controllerInstance.GetType();

            //Get the default culture from the config - can be overridden in the processing instructions, or at generation time in code
            var config        = ServiceProvider.GetService <IScryberConfigurationService>();
            var parserOptions = config.ParsingOptions;

            this.MissingReferenceAction = parserOptions.MissingReferenceAction;
            this.SpecificCulture        = parserOptions.GetDefaultCulture();
        }