Example #1
0
        public void Deletes_range_of_records_with_serial_id()
        {
            _db.TryDropTable("companydocuments");
            var companyStore = new SqliteDocumentStore <CompanyDocuments>(_db);
            var myBatch      = new List <CompanyDocuments>();
            int qtyToAdd     = 10;

            for (int i = 0; i < qtyToAdd; i++)
            {
                myBatch.Add(new CompanyDocuments {
                    Name = "Company Store #" + i, Address = i + " Company Parkway, Portland, OR 97204"
                });
            }
            companyStore.Add(myBatch);

            // Re-load from back-end:
            var companies = companyStore.TryLoadData();
            int qtyAdded  = companies.Count;

            // Select 5 for deletion:
            int qtyToDelete = 5;
            var deleteThese = companies.Where(c => c.Id <= qtyToDelete);

            // Delete:
            companyStore.Delete(deleteThese);
            int remaining = companyStore.TryLoadData().Count;

            Assert.IsTrue(qtyAdded == qtyToAdd && remaining == qtyAdded - qtyToDelete);
        }
        public void Deletes_range_of_records_with_string_id()
        {
            _db.TryDropTable("instrumentdocuments");
            var InstrumentStore = new SqliteDocumentStore <InstrumentDocuments>(_db);
            var myBatch         = new List <InstrumentDocuments>();
            int qtyToAdd        = 10;

            for (int i = 0; i < qtyToAdd; i++)
            {
                myBatch.Add(new InstrumentDocuments {
                    Id = "USA #" + i, Category = "String # " + i, Type = "Guitar"
                });
            }
            InstrumentStore.Add(myBatch);

            // Re-load from back-end:
            var companies = InstrumentStore.TryLoadData();
            int qtyAdded  = companies.Count;

            // Select 5 for deletion:
            int qtyToDelete = 5;
            var deleteThese = new List <InstrumentDocuments>();

            for (int i = 0; i < qtyToDelete; i++)
            {
                deleteThese.Add(companies.ElementAt(i));
            }

            // Delete:
            InstrumentStore.Delete(deleteThese);
            int remaining = InstrumentStore.TryLoadData().Count;

            Assert.IsTrue(qtyAdded == qtyToAdd && remaining == qtyAdded - qtyToDelete);
        }
Example #3
0
        public void Deletes_range_of_records_with_string_id()
        {
            _db.TryDropTable("guitardocuments");
            var guitarstore = new SqliteDocumentStore <GuitarDocuments>(_db);
            var myBatch     = new List <GuitarDocuments>();
            int qtyToAdd    = 10;

            for (int i = 0; i < qtyToAdd; i++)
            {
                myBatch.Add(new GuitarDocuments {
                    Sku = "USA # " + i, Make = "Fender", Model = "Stratocaster"
                });
            }
            guitarstore.Add(myBatch);

            // Re-load from back-end:
            var companies = guitarstore.TryLoadData();
            int qtyAdded  = companies.Count;

            // Select 5 for deletion:
            int qtyToDelete = 5;
            var deleteThese = new List <GuitarDocuments>();

            for (int i = 0; i < qtyToDelete; i++)
            {
                deleteThese.Add(companies.ElementAt(i));
            }

            // Delete:
            guitarstore.Delete(deleteThese);
            int remaining = guitarstore.TryLoadData().Count;

            Assert.IsTrue(qtyAdded == qtyToAdd && remaining == qtyAdded - qtyToDelete);
        }
        public void Deletes_range_of_records_with_int_id()
        {
            _db.TryDropTable("widgetdocuments");
            var widgetstore = new SqliteDocumentStore <WidgetDocuments>(_db);
            var myBatch     = new List <WidgetDocuments>();
            int qtyToAdd    = 10;

            for (int i = 0; i < qtyToAdd; i++)
            {
                myBatch.Add(new WidgetDocuments {
                    Identifier = i, Category = "Plastic # " + i
                });
            }
            widgetstore.Add(myBatch);

            // Re-load from back-end:
            var companies = widgetstore.TryLoadData();
            int qtyAdded  = companies.Count;

            // Select 5 for deletion:
            int qtyToDelete = 5;
            var deleteThese = new List <WidgetDocuments>();

            for (int i = 0; i < qtyToDelete; i++)
            {
                deleteThese.Add(companies.ElementAt(i));
            }

            // Delete:
            widgetstore.Delete(deleteThese);
            int remaining = widgetstore.TryLoadData().Count;

            Assert.IsTrue(qtyAdded == qtyToAdd && remaining == qtyAdded - qtyToDelete);
        }
Example #5
0
        public void Deletes_record_with_serial_id()
        {
            _db.TryDropTable("companydocuments");
            var companyStore = new SqliteDocumentStore <CompanyDocuments>(_db);
            var newCompany   = new CompanyDocuments {
                Name = "John's Coal Mining Supplies", Address = "16 Company Parkway, Portland, OR 97204"
            };

            companyStore.Add(newCompany);

            // Load from back-end:
            var companies = companyStore.TryLoadData();
            int qtyAdded  = companies.Count;

            // Delete:
            var foundCompany = companies.FirstOrDefault();

            companyStore.Delete(foundCompany);

            int remaining = companyStore.TryLoadData().Count;

            Assert.IsTrue(qtyAdded == 1 && remaining == 0);
        }
        public void Deletes_record_with_string_id()
        {
            _db.TryDropTable("instrumentdocuments");
            var InstrumentStore = new SqliteDocumentStore <InstrumentDocuments>(_db);
            var newInstrument   = new InstrumentDocuments {
                Id = "USA123", Category = "String", Type = "Guitar"
            };

            InstrumentStore.Add(newInstrument);

            // Load from back-end:
            var companies = InstrumentStore.TryLoadData();
            int qtyAdded  = companies.Count;

            // Delete:
            var foundInstrument = companies.FirstOrDefault();

            InstrumentStore.Delete(foundInstrument);

            int remaining = InstrumentStore.TryLoadData().Count;

            Assert.IsTrue(qtyAdded == 1 && remaining == 0);
        }
Example #7
0
        public void Deletes_record_with_string_id()
        {
            _db.TryDropTable("guitardocuments");
            var guitarstore = new SqliteDocumentStore <GuitarDocuments>(_db);
            var newGuitar   = new GuitarDocuments {
                Sku = "USA123", Make = "Gibson", Model = "Les Paul Custom"
            };

            guitarstore.Add(newGuitar);

            // Load from back-end:
            var companies = guitarstore.TryLoadData();
            int qtyAdded  = companies.Count;

            // Delete:
            var foundGuitar = companies.FirstOrDefault();

            guitarstore.Delete(foundGuitar);

            int remaining = guitarstore.TryLoadData().Count;

            Assert.IsTrue(qtyAdded == 1 && remaining == 0);
        }
        public void Deletes_record_with_int_id()
        {
            _db.TryDropTable("widgetdocuments");
            var widgetstore = new SqliteDocumentStore <WidgetDocuments>(_db);
            var newWidget   = new WidgetDocuments {
                Identifier = 100, Category = "Brass"
            };

            widgetstore.Add(newWidget);

            // Load from back-end:
            var companies = widgetstore.TryLoadData();
            int qtyAdded  = companies.Count;

            // Delete:
            var foundWidget = companies.FirstOrDefault();

            widgetstore.Delete(foundWidget);

            int remaining = widgetstore.TryLoadData().Count;

            Assert.IsTrue(qtyAdded == 1 && remaining == 0);
        }
    public void Deletes_range_of_records_with_string_id() {
      _db.TryDropTable("guitardocuments");
      var guitarstore = new SqliteDocumentStore<GuitarDocuments>(_db);
      var myBatch = new List<GuitarDocuments>();
      int qtyToAdd = 10;
      for (int i = 0; i < qtyToAdd; i++) {
        myBatch.Add(new GuitarDocuments { Sku = "USA # " + i, Make = "Fender", Model = "Stratocaster" });
      }
      guitarstore.Add(myBatch);

      // Re-load from back-end:
      var companies = guitarstore.TryLoadData();
      int qtyAdded = companies.Count;

      // Select 5 for deletion:
      int qtyToDelete = 5;
      var deleteThese = new List<GuitarDocuments>();
      for (int i = 0; i < qtyToDelete; i++) {
        deleteThese.Add(companies.ElementAt(i));
      }

      // Delete:
      guitarstore.Delete(deleteThese);
      int remaining = guitarstore.TryLoadData().Count;
      Assert.IsTrue(qtyAdded == qtyToAdd && remaining == qtyAdded - qtyToDelete);
    }
    public void Deletes_record_with_string_id() {
      _db.TryDropTable("guitardocuments");
      var guitarstore = new SqliteDocumentStore<GuitarDocuments>(_db);
      var newGuitar = new GuitarDocuments { Sku = "USA123", Make = "Gibson", Model = "Les Paul Custom" };
      guitarstore.Add(newGuitar);

      // Load from back-end:
      var companies = guitarstore.TryLoadData();
      int qtyAdded = companies.Count;

      // Delete:
      var foundGuitar = companies.FirstOrDefault();
      guitarstore.Delete(foundGuitar);

      int remaining = guitarstore.TryLoadData().Count;
      Assert.IsTrue(qtyAdded == 1 && remaining == 0);
    }
    public void Deletes_range_of_records_with_int_id() {
      _db.TryDropTable("widgetdocuments");
      var widgetstore = new SqliteDocumentStore<WidgetDocuments>(_db);
      var myBatch = new List<WidgetDocuments>();
      int qtyToAdd = 10;
      for (int i = 0; i < qtyToAdd; i++) {
        myBatch.Add(new WidgetDocuments { Identifier = i, Category = "Plastic # " + i });
      }
      widgetstore.Add(myBatch);

      // Re-load from back-end:
      var companies = widgetstore.TryLoadData();
      int qtyAdded = companies.Count;

      // Select 5 for deletion:
      int qtyToDelete = 5;
      var deleteThese = new List<WidgetDocuments>();
      for (int i = 0; i < qtyToDelete; i++) {
        deleteThese.Add(companies.ElementAt(i));
      }

      // Delete:
      widgetstore.Delete(deleteThese);
      int remaining = widgetstore.TryLoadData().Count;
      Assert.IsTrue(qtyAdded == qtyToAdd && remaining == qtyAdded - qtyToDelete);
    }
    public void Deletes_record_with_int_id() {
      _db.TryDropTable("widgetdocuments");
      var widgetstore = new SqliteDocumentStore<WidgetDocuments>(_db);
      var newWidget = new WidgetDocuments { Identifier = 100, Category = "Brass" };
      widgetstore.Add(newWidget);

      // Load from back-end:
      var companies = widgetstore.TryLoadData();
      int qtyAdded = companies.Count;

      // Delete:
      var foundWidget = companies.FirstOrDefault();
      widgetstore.Delete(foundWidget);

      int remaining = widgetstore.TryLoadData().Count;
      Assert.IsTrue(qtyAdded == 1 && remaining == 0);
    }
    public void Deletes_range_of_records_with_string_id() {
      _db.TryDropTable("instrumentdocuments");
      var InstrumentStore = new SqliteDocumentStore<InstrumentDocuments>(_db);
      var myBatch = new List<InstrumentDocuments>();
      int qtyToAdd = 10;
      for (int i = 0; i < qtyToAdd; i++) {
        myBatch.Add(new InstrumentDocuments { Id = "USA #" + i, Category = "String # " + i, Type = "Guitar" });
      }
      InstrumentStore.Add(myBatch);

      // Re-load from back-end:
      var companies = InstrumentStore.TryLoadData();
      int qtyAdded = companies.Count;

      // Select 5 for deletion:
      int qtyToDelete = 5;
      var deleteThese = new List<InstrumentDocuments>();
      for (int i = 0; i < qtyToDelete; i++) {
        deleteThese.Add(companies.ElementAt(i));
      }

      // Delete:
      InstrumentStore.Delete(deleteThese);
      int remaining = InstrumentStore.TryLoadData().Count;
      Assert.IsTrue(qtyAdded == qtyToAdd && remaining == qtyAdded - qtyToDelete);
    }
    public void Deletes_record_with_string_id() {
      _db.TryDropTable("instrumentdocuments");
      var InstrumentStore = new SqliteDocumentStore<InstrumentDocuments>(_db);
      var newInstrument = new InstrumentDocuments { Id = "USA123", Category = "String", Type = "Guitar" };
      InstrumentStore.Add(newInstrument);

      // Load from back-end:
      var companies = InstrumentStore.TryLoadData();
      int qtyAdded = companies.Count;

      // Delete:
      var foundInstrument = companies.FirstOrDefault();
      InstrumentStore.Delete(foundInstrument);

      int remaining = InstrumentStore.TryLoadData().Count;
      Assert.IsTrue(qtyAdded == 1 && remaining == 0);
    }
    public void Deletes_range_of_records_with_serial_id() {
      _db.TryDropTable("companydocuments");
      var companyStore = new SqliteDocumentStore<CompanyDocuments>(_db);
      var myBatch = new List<CompanyDocuments>();
      int qtyToAdd = 10;
      for (int i = 0; i < qtyToAdd; i++) {
        myBatch.Add(new CompanyDocuments { Name = "Company Store #" + i, Address = i + " Company Parkway, Portland, OR 97204" });
      }
      companyStore.Add(myBatch);

      // Re-load from back-end:
      var companies = companyStore.TryLoadData();
      int qtyAdded = companies.Count;

      // Select 5 for deletion:
      int qtyToDelete = 5;
      var deleteThese = companies.Where(c => c.Id <= qtyToDelete);

      // Delete:
      companyStore.Delete(deleteThese);
      int remaining = companyStore.TryLoadData().Count;
      Assert.IsTrue(qtyAdded == qtyToAdd && remaining == qtyAdded - qtyToDelete);
    }
    public void Deletes_record_with_serial_id() {
      _db.TryDropTable("companydocuments");
      var companyStore = new SqliteDocumentStore<CompanyDocuments>(_db);
      var newCompany = new CompanyDocuments { Name = "John's Coal Mining Supplies", Address = "16 Company Parkway, Portland, OR 97204" };
      companyStore.Add(newCompany);

      // Load from back-end:
      var companies = companyStore.TryLoadData();
      int qtyAdded = companies.Count;

      // Delete:
      var foundCompany = companies.FirstOrDefault();
      companyStore.Delete(foundCompany);

      int remaining = companyStore.TryLoadData().Count;
      Assert.IsTrue(qtyAdded == 1 && remaining == 0);
    }