コード例 #1
0
        /// <summary>The process template.</summary>
        /// <param name="text">The text.</param>
        /// <param name="items">The items.</param>
        /// <returns></returns>
        public TemplateResult ProcessTemplate(string text, Dictionary<string, object> items)
        {
            if (items == null)
            {
                items = new Dictionary<string, object>();
            }

            TemplateResult result;

            using (TemplateHost host = _services.Resolve<TemplateHost>())
            {
                host.Data = _templateData;

                items.Add("Host", host);
                items.Add("Data", host.Data);

                result = new TemplateResult();
                result.Text = _formatter.Format(text, items);
                result.Extension = "sql";
                if (items.ContainsKey(Extension))
                {
                    result.Extension = (string)items[Extension];
                }
            }

            return result;
        }
コード例 #2
0
 public void TestSetUp()
 {
     _services = MockRepository.GenerateStub<IApplicationServices>();
     _databaseInspector = MockRepository.GenerateStub<IDatabaseInspector>();
     _host = new TemplateHost(_services, _databaseInspector);
 }