public void GetBytesWithKeyRetrievesNullWhenKeyNotExists() { using (var repo = new DBreezeTestNoSqlRepository("TestRepo", AssureEmptyDir("TestData/DBreezeNoSqlRepository/GetBytesWithKeyRetrievesNullWhenKeyNotExists"))) { var task = repo.GetBytes("testKey"); task.Wait(); Assert.Equal(null, task.Result); } }
public void GetBytesWithKeyRetrievesBytesForExistingGivenKey() { var dir = AssureEmptyDir("TestData/DBreezeNoSqlRepository/GetBytesWithKeyRetrievesBytesForExistingGivenKey"); using (var engine = new DBreezeEngine(dir)) { var transaction = engine.GetTransaction(); transaction.Insert("TestRepo", "testKey", Encoding.UTF8.GetBytes("keyValueResult")); transaction.Commit(); } using (var repo = new DBreezeTestNoSqlRepository("TestRepo", dir)) { var task = repo.GetBytes("testKey"); task.Wait(); Assert.Equal("keyValueResult", Encoding.UTF8.GetString(task.Result)); } }