Пример #1
0
        public void Test_XmlConfigurationInterpreter_via_FilePath()
        {
            string uri = "SqlMap_Test_Configure.config";
            IConfigurationStore store = new DefaultConfigurationStore();

            IConfigurationInterpreter interpreter = new XmlConfigurationInterpreter(uri);

            interpreter.ProcessResource(store);

            CheckResource(store);
        }
        public void Test_DefaultModelBuilder()
        {
            string uri = "SqlMap_Test_Configure.config";
            IConfigurationStore store = new DefaultConfigurationStore();

            IConfigurationInterpreter interpreter = new XmlConfigurationInterpreter(uri);

            interpreter.ProcessResource(store);
            //Console.WriteLine(store.ToString());

            IModelStore modelStore = new DefaultModelStore();
            IModelBuilder builder = new DefaultModelBuilder(modelStore);

            builder.BuildModel(null, store);

            CheckModelStore(modelStore);
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JsonInterpreter"/> class.
        /// </summary>
        /// <param name="source">The <see cref="IResource"/>.</param>
        public JsonInterpreter(IResource source) : base(source)
        {
            string xmlContents = string.Empty;
            using(source)
            {
                JsonReader reader = new JsonTextReader(new StreamReader(source.Stream));
                reader.Read();

                XmlNodeConverter toXml = new XmlNodeConverter();
                XmlDocument xmlDoc = (XmlDocument)toXml.ReadJson(reader, typeof(XmlDocument));
                xmlContents = xmlDoc.OuterXml;
                reader.Close();                
            }

            IResource resource = new StaticContentResource(xmlContents);

            xmlInterpreter = new XmlConfigurationInterpreter(resource);
        }
Пример #4
0
        public void Test_XmlConfigurationInterpreter_via_FilePath_WithoutProtocol()
        {
            string uri ="SqlMap_Test_Configure.config";
            IConfigurationStore store = new DefaultConfigurationStore();

            IConfigurationInterpreter interpreter = new XmlConfigurationInterpreter(
                ResourceLoaderRegistry.GetResource(uri));

            interpreter.ProcessResource(store);

            CheckResource(store);
        }
Пример #5
0
        public void Test_XmlConfigurationInterpreter_via_AssemblyUri()
        {
            string uri = "assembly://MyBatis.DataMapper.SqlClient.Test/bin.Debug/SqlMap_Test_Configure.config";

            IConfigurationStore store = new DefaultConfigurationStore();

            IConfigurationInterpreter interpreter = new XmlConfigurationInterpreter(
                ResourceLoaderRegistry.GetResource(uri));

            interpreter.ProcessResource(store);

            CheckResource(store);
        }