public void TestGetBlobFromDB() { var blob = ArrayTestBlob(); Db.SaveBlob(blob); var blobDict = new Dictionary <string, object>() { { Blob.ContentTypeKey, blob.ContentType }, { Blob.DigestKey, blob.Digest }, { Blob.LengthKey, blob.Length }, { Constants.ObjectTypeProperty, "blob" } }; var blobFromDict = Db.GetBlob(blobDict); blob.Equals(blobFromDict).Should().BeTrue(); //At this point Constants.ObjectTypeProperty key value pair is removed from the blobDict Action badAction = (() => Db.GetBlob(blobDict)); badAction.Should().Throw <ArgumentException>(CouchbaseLiteErrorMessage.InvalidJSONDictionaryForBlob); //Add back Constants.ObjectTypeProperty key value pair blobDict.Add(Constants.ObjectTypeProperty, "blob"); blobDict.Remove(Blob.DigestKey); blobFromDict = Db.GetBlob(blobDict); blobFromDict.Should().BeNull(); }
public void TestGetBlobFromCompactDB() { var blob = ArrayTestBlob(); Db.SaveBlob(blob); Db.PerformMaintenance(MaintenanceType.Compact); var blobDict = new Dictionary <string, object>() { { Blob.ContentTypeKey, blob.ContentType }, { Blob.DigestKey, blob.Digest }, { Blob.LengthKey, blob.Length }, { Constants.ObjectTypeProperty, "blob" } }; var blobFromDict = Db.GetBlob(blobDict); blobFromDict.Should().BeNull(); }