public void Inser100DocumentsDelete100DocumentsInsert100CheckFileSizeIsSameAsAfterDelete() { using (var sp = new StorageProcessor(_dataDirectory, _entity, _serializer)) { sp.DestroyExistingData(); for (int i = 1; i < 101; i++) { sp.Store<PersonEntity>(new PersonEntity() { Id = i, Name = "Test", Email = "Test" }); #if DEBUG Console.WriteLine("File Size: " + sp.FileSize); #endif } // store file size for the assert long fileSize = sp.FileSize; for (int i = 1; i < 101; i++) { sp.Delete(i); #if DEBUG Console.WriteLine("File Size: " + sp.FileSize); #endif } Assert.AreEqual(fileSize, sp.FileSize); // store another documet file size should be the same. for (int i = 1; i < 101; i++) { sp.Store<PersonEntity>(new PersonEntity() { Id = i, Name = "Test", Email = "Test" }); #if DEBUG Console.WriteLine("File Size: " + sp.FileSize); #endif } Assert.AreEqual(fileSize, sp.FileSize); } }
public void InsertOneDocumentDeleteDocumentInsertNewDocumentWithSameSizeCheckFileSizeIsSame() { using (var sp = new StorageProcessor(_dataDirectory, _entity, _serializer)) { sp.DestroyExistingData(); // insert one record and get file size var entity = new PersonEntity() { Name = "Test", Email = "Test" }; var entity2 = new PersonEntity() { Name = "Test", Email = "Test" }; sp.Store<PersonEntity>(entity); // store file size for the assert long fileSize = sp.FileSize; sp.Delete(entity.Id); Assert.AreEqual(fileSize, sp.FileSize); // store another documet file size should be the same. sp.Store<PersonEntity>(entity2); Assert.AreEqual(fileSize, sp.FileSize); } }
public void StoreThreeDocumentsDeleteOneDocumentLoadDeletedDocumentReturnsNull() { using (var sp = new StorageProcessor(_dataDirectory, _entity, _serializer)) { sp.DestroyExistingData(); var person = new PersonEntity() { Name = "Test 2", Email = "Test 2" }; sp.Store<PersonEntity>(person); sp.Store<PersonEntity>(new PersonEntity() { Name = "Test 1", Email = "Test 1" }); sp.Delete(person.Id); var loadPerson = sp.Load<PersonEntity>(person.Id); Assert.IsNull(loadPerson); } }
public void Insert1RecordsCheckCount1RemoveCheckDocumentCountIs0() { using (var sp = new StorageProcessor(_dataDirectory, _entity, _serializer)) { sp.DestroyExistingData(); var person = new PersonEntity() { Name = "Person " + 1, Email = "Email " + 1 }; sp.Store<PersonEntity>(person); Assert.AreEqual(1, sp.Count()); sp.Delete(person.Id); Assert.AreEqual (0, sp.Count()); } }