Esempio n. 1
0
        public void TestLoadPersistence()
        {
            string path = "file.json";

            if (File.Exists(path))
            {
                File.Delete(path);
                TestSavePersistence();
            }

            bool loaded = new DatabaseConfigPersistence().TryLoad(path, out DBConfig model, out string error);

            Assert.IsTrue(string.IsNullOrEmpty(error) || loaded, $"Somes errors occured : {error}");

            DBConfig db = new DBConfig()
            {
                DBName   = "database_name",
                IP       = "127.0.0.1",
                Password = "******",
                Port     = 3301,
                Username = "******",
                Type     = DBType.MySQL
            };

            Assert.IsTrue(db.Equals(model));
        }