コード例 #1
0
        public void Setup()
        {
            cm       = new XmlConfigManager(Resources.TestDirectory, Resources.ConfigFile);
            database = new DbIndexPersistence(cm);
            string dbName = cm.GetItemByName("NextDatabase");

            string connStr =
                $"server={Environment.GetEnvironmentVariable("DB_HOST")};" +
                $"user={Environment.GetEnvironmentVariable("DB_USER")};" +
                $"database={dbName};port=3306;" +
                $"password={Environment.GetEnvironmentVariable("DB_PWD")}";

            conn = new MySqlConnection(connStr);

            tagLinks.Add(tag1, new List <string>()
            {
                "1.png", "2.png", "3.jpg"
            });
            tagLinks.Add(tag2, new List <string>()
            {
                "3.jpg", "4.png"
            });
            tagLinks.Add(tag3, new List <string>()
            {
                "6.png"
            });

            seriesTags.Add(series, new HashSet <string>()
            {
                tag1, tag2
            });
        }
コード例 #2
0
        public void TestGetSetByName()
        {
            IConfigManager cm          = new XmlConfigManager(Resources.TestDirectory, Resources.ConfigFile);
            string         elementName = "NumThreads";

            int numThreads = int.Parse(cm.GetItemByName(elementName));

            if (numThreads > 2)
            {
                numThreads /= 2;
            }
            else
            {
                numThreads *= 2;
            }

            cm.ChangeItemByName(elementName, numThreads.ToString());

            int newNumThreads = int.Parse(cm.GetItemByName(elementName));

            Assert.AreEqual(numThreads, newNumThreads);
        }