コード例 #1
0
        public void AddFieldsManuallyToClassWithPrivateVariables()
        {
            var x = new TestFieldsClass2("Hello", 12);

            var fields = new global::SQLiteServer.Fields.Fields();

            fields.Add(new Field("A", typeof(string), "Hello"));
            fields.Add(new Field("B", typeof(int), 12));

            var y = global::SQLiteServer.Fields.Fields.DeserializeObject <TestFieldsClass2>(fields);

            // we cannot set private values...
            Assert.AreEqual(default(string), y.A);
            Assert.AreEqual(default(int), y.B);
        }
コード例 #2
0
        public void AddFieldsManuallyToStructure()
        {
            var x = new TestFieldsStructure
            {
                A = "Hello",
                B = 12
            };

            var fields = new global::SQLiteServer.Fields.Fields();

            fields.Add(new Field("A", typeof(string), "Hello"));
            fields.Add(new Field("B", typeof(int), 12));

            var y = global::SQLiteServer.Fields.Fields.DeserializeObject <TestFieldsStructure>(fields);

            Assert.AreEqual(x.A, y.A);
            Assert.AreEqual(x.B, y.B);
        }
コード例 #3
0
        public void ManualCreatePackAndUnpackAndDeserializeObject()
        {
            var s1 = new TestFieldsStructure
            {
                A = "Hello",
                B = 12
            };

            var fields = new global::SQLiteServer.Fields.Fields();

            fields.Add(new Field("A", "Hello"));
            fields.Add(new Field("B", 12));

            var pack    = fields.Pack();
            var fields2 = global::SQLiteServer.Fields.Fields.Unpack(pack);
            var s2      = global::SQLiteServer.Fields.Fields.DeserializeObject <TestFieldsStructure>(fields2);

            Assert.AreEqual(s1.A, s2.A);
            Assert.AreEqual(s1.B, s2.B);
        }
コード例 #4
0
        public void PackAndUnpackSingleField()
        {
            var fields = new global::SQLiteServer.Fields.Fields();

            fields.Add(new Field("Hello", "World"));

            var pack    = fields.Pack();
            var fields2 = global::SQLiteServer.Fields.Fields.Unpack(pack);

            Assert.That(fields2.Count == 1);
        }