public async Task GetAllTest() { Database4 = new DocumentDatabase(new IndexModel("bin_stor3", "bin_stor3")); foreach (var d in DocumentModel) { await Database4.Insert(d); } var actual = await Database4.GetAllDocuments(); foreach (var model in DocumentModel) { Assert.IsTrue(actual.Select(x => x.Id).Contains(model.Id)); } }
public async Task CreateTest() { Database1 = new DocumentDatabase(new IndexModel("bin_stor", "bin_stor")); foreach (var d in DocumentModel) { await Database1.Insert(d); } for (var i = 0; i < 7; i++) { var actual = await Database1.Find(DocumentModel[i].Id); Assert.AreEqual(DocumentModel[i].Value, actual.Value); } }
public async Task DeleteTest() { Database3 = new DocumentDatabase(new IndexModel("bin_stor2", "bin_stor2")); foreach (var d in DocumentModel) { await Database3.Insert(d); } var model = DocumentModel.First(); await Database3.Delete(model); var actual = await Database3.Find(model.Id); Assert.IsNull(actual); }
public async Task UpdateTest() { Database2 = new DocumentDatabase(new IndexModel("bin_stor1", "bin_stor1")); foreach (var d in DocumentModel) { await Database2.Insert(d); } var value = DocumentModel[1].Value; var model = DocumentModel.First(); model.Value = value; await Database2.Update(model); var actual = await Database2.Find(model.Id); Assert.AreEqual(value, actual.Value); }