Example #1
0
        public void PropertyExistsTest()
        {
            var p = new CMSProperties(_database);

            p.SaveProperty(TestPropName, "doesn't matter");
            Assert.IsTrue(p.PropertyExists(TestPropName));
        }
Example #2
0
        public void PropertyNotExistsTest()
        {
            var p = new CMSProperties(_database);

            p.DeleteProperty(TestPropName);
            Assert.IsFalse(p.PropertyExists(TestPropName));
        }
 public VoxelWorld(int chunkSize, CMSProperties cmsProperties, Transform transform, IndexerFactory <TIndexer> indexerFactory)
 {
     ChunkSize      = chunkSize;
     CMSProperties  = cmsProperties;
     Transform      = transform;
     IndexerFactory = indexerFactory;
 }
Example #4
0
        public void FillSingleValueBooleanTest()
        {
            var p = new CMSProperties(_database);

            p.SaveProperty(Test01Name, true);
            var b = _database.FillSingleValueBoolean($"SELECT Value FROM Properties WHERE Property='{Test01Name}'");

            Assert.IsTrue(b);
        }
Example #5
0
        public void FillDataSetTest()
        {
            var p = new CMSProperties(_database);

            p.SaveProperty(Test01Name, Test01Value);
            var ds = _database.FillDataSet("SELECT * FROM Properties");

            Assert.IsTrue(ds.Tables[0].Rows.Count > 0);
        }
Example #6
0
        public void FillSingleValueIntegerTest()
        {
            var p = new CMSProperties(_database);

            p.SaveProperty(Test01Name, 42);
            var i = _database.FillSingleValueInteger($"SELECT Value FROM Properties WHERE Property='{Test01Name}'");

            Assert.AreEqual(i, 42);
        }
Example #7
0
        public void GetPropertyBoolTestUsingInt0()
        {
            var p = new CMSProperties(_database);

            p.SaveProperty(TestPropName, 0);
            var b = p.GetProperty(TestPropName, true);

            Assert.AreEqual(b, false);
        }
Example #8
0
        public void GetPropertyValueListTest()
        {
            var p = new CMSProperties(_database);

            p.SaveProperty(TestPropName, "abc,123,xyz,789");
            var l = p.GetPropertyValueList(TestPropName, "1,2");

            Assert.AreEqual(l.Count, 4);
        }
Example #9
0
        public void GetPropertyTimestampTest()
        {
            var p = new CMSProperties(_database);

            p.SaveProperty(TestPropName, "doesn't matter");
            var d = p.GetPropertyTimestamp(TestPropName);

            Assert.AreNotEqual(d, DateTime.MinValue);
        }
Example #10
0
        public void FillSingleValueTest()
        {
            var p = new CMSProperties(_database);

            p.SaveProperty(Test01Name, "String Value");
            var s = _database.FillSingleValue($"SELECT Value FROM Properties WHERE Property='{Test01Name}'");

            Assert.AreEqual(s, "String Value");
        }
Example #11
0
        public void GetPropertyStringDefaultTest()
        {
            var p = new CMSProperties(_database);

            p.DeleteProperty(TestPropName);
            var testValue = Guid.NewGuid().ToString();
            var s         = p.GetProperty(TestPropName, testValue);

            Assert.AreEqual(s, testValue);
        }
Example #12
0
        public void SavePropertyDateTimeTest()
        {
            var p  = new CMSProperties(_database);
            var d1 = DateTime.UtcNow;

            p.SaveProperty(TestPropName, d1);
            var d2 = p.GetProperty(TestPropName, DateTime.MinValue);

            Assert.AreEqual(d1, d2);
        }
Example #13
0
        public void SavePropertyTest()
        {
            var p         = new CMSProperties(_database);
            var testValue = Guid.NewGuid().ToString();

            p.SaveProperty(TestPropName, testValue);
            var s = p.GetProperty(TestPropName, "");

            Assert.AreEqual(s, testValue);
        }
Example #14
0
        public void FillSingleValueDateTimeTest()
        {
            var p  = new CMSProperties(_database);
            var d1 = DateTime.UtcNow;

            p.SaveProperty(Test01Name, d1);
            var d2 = _database.FillSingleValueDateTime($"SELECT Value FROM Properties WHERE Property='{Test01Name}'");

            Assert.AreEqual(d1, d2);
        }
Example #15
0
        public void ExistsQueryTest()
        {
            var p = new CMSProperties(_database);

            p.SaveProperty(Test01Name, Test01Value);
            var b = _database.ExistsQuery("SELECT Property FROM Properties LIMIT 1");

            Assert.AreEqual(b, true);
            b = _database.ExistsQuery($"SELECT Property FROM Properties WHERE Value='{Guid.NewGuid()}' LIMIT 1");
            Assert.AreEqual(b, false);
        }
Example #16
0
        public void DeletePropertyTest()
        {
            var p         = new CMSProperties(_database);
            var testValue = Guid.NewGuid().ToString();

            p.SaveProperty(TestPropName, testValue);
            Assert.IsTrue(p.PropertyExists(TestPropName));

            p.DeleteProperty(TestPropName);
            Assert.IsFalse(p.PropertyExists(TestPropName));
        }
Example #17
0
        public void GetPropertyIntTest()
        {
            var    p   = new CMSProperties(_database);
            Random rnd = new Random();
            var    i1  = rnd.Next(1, 999);

            p.SaveProperty(TestPropName, i1);
            var i2 = p.GetProperty(TestPropName, 0);

            Assert.AreEqual(i1, i2);
        }