public void InsertOneDocumentUpdateDocumentSoRelocatedInsertNewDocumentWithSameSizeCheckFileSizeIsSame() { 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 entity.Name = "1000000hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"; sp.Update<PersonEntity>(entity); var fileSize = sp.FileSize; 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 Insert1RecordChangeDataAndUpdateCheckUpdated() { using (var sp = new StorageProcessor(_dataDirectory, _entity, _serializer)) { sp.DestroyExistingData(); var person = new PersonEntity() { Name = "Person", Email = "Email" }; sp.Store<PersonEntity>(person); Assert.AreEqual(1, sp.Count()); var existingPerson = sp.Load<PersonEntity>(person.Id); existingPerson.Name = "Person With Longer Name"; sp.Update<PersonEntity>(existingPerson); Assert.AreEqual(1, sp.Count()); // check updated var updatedPerson = sp.Load<PersonEntity>(person.Id); Assert.AreEqual ("Person With Longer Name", updatedPerson.Name); } }