Beispiel #1
0
        public void QueryTwo()
        {
            var procedures = ProceduralDb.Query("nonsense", ".*", ".*", ".*", ".*",
                                                ".*", ".*");

            Assert.AreEqual(0, procedures.Count);
        }
Beispiel #2
0
        public void TempName()
        {
            string tempName = ProceduralDb.TempName();

            Assert.IsNotNull(tempName);
            Assert.Greater(tempName.Length, 0);
        }
Beispiel #3
0
        public void QueryOne()
        {
            var procedures = ProceduralDb.Query(".*", ".*", ".*", ".*", ".*", ".*",
                                                ".*");

            Assert.Greater(procedures.Count, 0);
            Assert.IsTrue(procedures.All(p => ProceduralDb.ProcExists(p)));
        }
        public void GetData(VariableSet variables)
        {
            var data = ProceduralDb.GetData(_name);

            if (data != null)
            {
                var stream = new MemoryStream(data);
                variables.ForEach(v => v.Deserialize(_formatter, stream));
            }
        }
        public void SetData(VariableSet variables)
        {
            var stream = new MemoryStream();

            variables.ForEach(v => v.Serialize(_formatter, stream));
            if (stream.Length != 0)
            {
                ProceduralDb.SetData(_name, stream.GetBuffer());
            }
        }
Beispiel #6
0
        public void GetDataSize()
        {
            string identifier = ProceduralDb.TempName();
            var    encoding   = new System.Text.ASCIIEncoding();

            const string testString = "This is a test";
            var          data       = encoding.GetBytes(testString);

            ProceduralDb.SetData(identifier, data);

            Assert.AreEqual(data.Length, ProceduralDb.GetDataSize(identifier));
        }
        public void GetData()
        {
            var data = ProceduralDb.GetData(_name);

            if (data != null)
            {
                var memoryStream = new MemoryStream(data);
                var type         = _plugin.GetType();

                foreach (var attribute in new SaveAttributeSet(type))
                {
                    var field = attribute.Field;
                    field.SetValue(_plugin, _formatter.Deserialize(memoryStream));
                }
            }
        }
        public void SetData()
        {
            var memoryStream = new MemoryStream();

            var type = _plugin.GetType();

            foreach (var attribute in new SaveAttributeSet(type))
            {
                var field = attribute.Field;
                _formatter.Serialize(memoryStream, field.GetValue(_plugin));
            }

            if (memoryStream.Length != 0)
            {
                ProceduralDb.SetData(_name, memoryStream.GetBuffer());
            }
        }
Beispiel #9
0
 static public bool Exists(string name)
 {
     return(ProceduralDb.ProcExists(name));
 }
Beispiel #10
0
 static public bool Exists(string name) => ProceduralDb.ProcExists(name);
Beispiel #11
0
 public void Exists()
 {
     Assert.IsFalse(ProceduralDb.ProcExists("nonsense"));
     Assert.IsTrue(ProceduralDb.ProcExists("gimp-image-new"));
 }