예제 #1
0
    public void Can_set_and_retrieve_reference_by_key()
    {
        var record       = new CKRecord("record_type");
        var reference    = new CKReference(new CKRecord("record_type"), CKReferenceAction.DeleteSelf);
        var referenceKey = "reference_key";

        record.SetReference(reference, referenceKey);

        Assert.AreEqual(record.ReferenceForKey(referenceKey), reference);
    }
예제 #2
0
    public void All_keys_has_all_the_keys()
    {
        var record = new CKRecord("record_type");
        var keys   = new string[] { "string_key", "bool_key", "int_key", "double_key", "buffer_key", "asset_key", "reference_key" };

        record.SetString(keys[0], "string_value");
        record.SetInt(1, keys[1]);
        record.SetDouble(1f, keys[2]);
        record.SetBuffer(new byte[] { }, keys[3]);
        record.SetAsset(new CKAsset(null), keys[4]);
        record.SetReference(new CKReference(new CKRecordID("record"), CKReferenceAction.DeleteSelf), keys[5]);

        var allKeys = record.AllKeys();

        foreach (var key in allKeys)
        {
            Assert.IsTrue(allKeys.Contains(key));
        }
    }