Beispiel #1
0
        public static void GetSchemaAndTestFullGDID(ICrudDataStore store)
        {
            var schema = store.GetSchema(new Query("CRUD.Queries.FullGDID.Load"));

            var row = new DynamicDoc(schema);

            var key = new GDID(179, 1, 1234567890);

            Console.WriteLine(key.Bytes.ToDumpString(DumpFormat.Hex));

            row["GDID"] = new GDID(179, 1, 1234567890);
            Console.WriteLine(((byte[])row["GDID"]).ToDumpString(DumpFormat.Hex));

            row["VARGDID"]     = new GDID(12, 9, 9876543210);
            row["STRING_NAME"] = "DA DA DA!";

            store.Insert(row);

            var row2 = store.LoadOneDoc(new Query("CRUD.Queries.FullGDID.Load", key, typeof(FullGDID))) as FullGDID;

            Aver.IsNotNull(row2);
            Aver.AreEqual(key, row2.GDID);
            Aver.AreEqual(new GDID(12, 9, 9876543210), row2.VARGDID);
            Aver.AreObjectsEqual("DA DA DA!", row2["String_Name"]);
        }
Beispiel #2
0
        public static void GetSchemaAndTestVariousTypes(ICrudDataStore store)
        {
            var schema = store.GetSchema(new Query("CRUD.Queries.Types.Load"));

            var row = new DynamicDoc(schema);

            row["GDID"]        = new GDID(0, 145);
            row["SCREEN_NAME"] = "User1";
            row["STRING_NAME"] = "Some user 1";
            row["CHAR_NAME"]   = "Some user 2";
            row["BOOL_CHAR"]   = 'T';
            row["BOOL_BOOL"]   = true;

            row["AMOUNT"] = 145670.23m;

            row["DOB"] = new DateTime(1980, 12, 1);

            store.Insert(row);

            var row2 = store.LoadOneDoc(new Query("CRUD.Queries.Types.Load", new GDID(0, 145)));

            Aver.IsNotNull(row2);
            Aver.AreObjectsEqual(145, row2["GDID"].AsInt());
            Aver.AreObjectsEqual("User1", row2["Screen_Name"].AsString().Trim());
            Aver.AreObjectsEqual("Some user 1", row2["String_Name"].AsString().Trim());
            Aver.AreObjectsEqual("Some user 2", row2["Char_Name"].AsString().Trim());

            Aver.AreEqual(true, row2["BOOL_Char"].AsBool());
            Aver.AreEqual(true, row2["BOOL_BOOL"].AsBool());

            Aver.AreObjectsEqual(145670.23m, row2["Amount"].AsDecimal());

            Aver.AreEqual(1980, row2["DOB"].AsDateTime().Year);
        }
Beispiel #3
0
        public static void TypedRowTest_FullGDID(ICrudDataStore store)
        {
            var row = new FullGDID();

            row.GDID           = new GDID(123, 2, 8907893234);
            row.VARGDID        = row.GDID;
            row["STRING_NAME"] = "AAA";

            store.Insert(row);

            var row2 = store.LoadOneDoc(new Query("CRUD.Queries.FullGDID.Load", new GDID(123, 2, 8907893234), typeof(FullGDID))) as FullGDID;

            Aver.IsNotNull(row2);
            Aver.AreEqual(new GDID(123, 2, 8907893234), row2.GDID);
            Aver.AreEqual(new GDID(123, 2, 8907893234), row2.VARGDID);
            Aver.AreObjectsEqual("AAA", row2["String_Name"]);
        }