Exemple #1
0
        public static async Task ASYNC_GetSchemaAndTestVariousTypes(ICrudDataStore store)
        {
            var schema = await store.GetSchemaAsync(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 = await store.LoadOneDocAsync(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);
        }