Ejemplo n.º 1
0
 public void CheckDocumentCountIsZero()
 {
     using (var sp = new StorageProcessor(_dataDirectory, _entity, _serializer))
     {
         sp.DestroyExistingData();
     long count =  sp.Count();
     Assert.AreEqual (0, count);
     }
 }
Ejemplo n.º 2
0
 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());
     }
 }
Ejemplo n.º 3
0
        public void Insert100RecordsLoad100CheckAllMatchInserted()
        {
            using (var sp = new StorageProcessor(_dataDirectory, _entity, _serializer))
            {
                sp.DestroyExistingData();
                for (int i = 1; i < 101; i++) {
                    sp.Store<PersonEntity>(new PersonEntity() { Name = "Person " + i, Email = "Email " + i });
                    #if DEBUG
                    Console.WriteLine("INSERT: {0}", i);
                    #endif
                }
                long count =  sp.Count();
                Assert.AreEqual (100, count);

                // load
                var records = sp.Load<PersonEntity>();
                int countCheck = 1;
                foreach(var r in records){
                    Assert.AreEqual(r.Name, "Person " + countCheck);
                    Assert.AreEqual(r.Email, "Email " + countCheck);
                    countCheck++;
                }
            }
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
        public void Insert100DocumentsCheckDocumentCountIs100()
        {
            using (var sp = new StorageProcessor(_dataDirectory, _entity, _serializer))
            {
                sp.DestroyExistingData();
            for (int i = 1; i < 101; i++) {
                 sp.Store<PersonEntity>(new PersonEntity() { Name = "Person " + i, Email = "Email " + i });
                #if DEBUG
                Console.WriteLine("INSERT: {0}", i);
                #endif
            }
            long count =  sp.Count();
            Assert.AreEqual (100, count);

            }
        }