public void Updates_Document_With_Serial_PK()
        {
            var newCustomer = new ClientDocument {
                Email     = "*****@*****.**",
                FirstName = "Rob",
                LastName  = "Conery"
            };

            _clientDocuments.Add(newCustomer);
            int idToFind = newCustomer.ClientDocumentId;

            // Go find the new record after reloading:
            _clientDocuments = new BiggyList <ClientDocument>(new PGDocumentStore <ClientDocument>(_connectionStringName));
            var updateMe = _clientDocuments.FirstOrDefault(cd => cd.ClientDocumentId == idToFind);

            // Update:
            updateMe.FirstName = "Bill";
            _clientDocuments.Update(updateMe);

            // Go find the updated record after reloading:
            _clientDocuments = new BiggyList <ClientDocument>(new PGDocumentStore <ClientDocument>(_connectionStringName));
            var updated = _clientDocuments.FirstOrDefault(cd => cd.ClientDocumentId == idToFind);

            Assert.True(updated.FirstName == "Bill");
        }
Esempio n. 2
0
        public void Updates_Item_In_List_But_Not_Store()
        {
            _biggyMemoryList = new BiggyList <Widget>(_widgetStore, inMemory: true);
            var updateMe = _biggyMemoryList.FirstOrDefault(w => w.SKU == "001");

            // Update and Save:
            updateMe.Name = "UPDATED";
            _biggyMemoryList.Update(updateMe);

            // Grab from the list:
            var updatedInList       = _biggyMemoryList.FirstOrDefault(w => w.SKU == "001");
            var storeWidgets        = _widgetStore.Load();
            var originalSotreWidget = storeWidgets.FirstOrDefault(w => w.SKU == "001");

            // Make sure updated in List, but not store:
            Assert.True(updatedInList.Name == "UPDATED" && originalSotreWidget.Name != "UPDATED");
        }
        public void Adds_Item_To_List_But_Not_Store()
        {
            _biggyMemoryList = new BiggyList<Widget>(_widgetStore, inMemory: true);
              _biggyMemoryList.Add(new Widget { SKU = "1000", Name = "Test widget 1", Price = 2.00M });
              var storeWidgets = _widgetStore.Load();

              var addedItem = _biggyMemoryList.FirstOrDefault(w => w.SKU == "001");
              Assert.True(addedItem != null && _biggyMemoryList.Count() == INSERT_QTY + 1 && storeWidgets.Count() == INSERT_QTY);
        }
Esempio n. 4
0
        public void Adds_Item_To_List_And_Store()
        {
            _biggyWidgetList.Clear();
              _biggyWidgetList.Add(new Widget { SKU = "001", Name = "Test widget 1", Price = 2.00M });

              // Reload the list:
              _biggyWidgetList = new BiggyList<Widget>(_widgets);
              var addedItem = _biggyWidgetList.FirstOrDefault(w => w.SKU == "001");
              Assert.True(addedItem != null && _biggyWidgetList.Count() == 1);
        }
Esempio n. 5
0
        public void Removes_Item_From_List_But_Not_Store()
        {
            _biggyMemoryList = new BiggyList <Widget>(_widgetStore, inMemory: true);

            var removeMe = _biggyMemoryList.FirstOrDefault();

            _biggyMemoryList.Remove(removeMe);
            var storeWidgets = _widgetStore.Load();

            Assert.True(_biggyMemoryList.Count() == INSERT_QTY - 1 && storeWidgets.Count == INSERT_QTY);
        }
Esempio n. 6
0
        public void Adds_Item_To_List_But_Not_Store()
        {
            _biggyMemoryList = new BiggyList <Widget>(_widgetStore, inMemory: true);
            _biggyMemoryList.Add(new Widget {
                SKU = "1000", Name = "Test widget 1", Price = 2.00M
            });
            var storeWidgets = _widgetStore.Load();

            var addedItem = _biggyMemoryList.FirstOrDefault(w => w.SKU == "001");

            Assert.True(addedItem != null && _biggyMemoryList.Count() == INSERT_QTY + 1 && storeWidgets.Count() == INSERT_QTY);
        }
Esempio n. 7
0
        public void Adds_Item_To_List_And_Store()
        {
            _biggyWidgetList.Clear();
            _biggyWidgetList.Add(new Widget {
                SKU = "001", Name = "Test widget 1", Price = 2.00M
            });

            // Reload the list:
            _biggyWidgetList = new BiggyList <Widget>(_widgets);
            var addedItem = _biggyWidgetList.FirstOrDefault(w => w.SKU == "001");

            Assert.True(addedItem != null && _biggyWidgetList.Count() == 1);
        }
Esempio n. 8
0
        public void Removes_Item_From_List_And_Store()
        {
            _biggyWidgetList.Clear();
            _biggyWidgetList.Add(new Widget {
                SKU = "001", Name = "Test widget 1", Price = 2.00M
            });

            // Reload:
            _biggyWidgetList = new BiggyList <Widget>(_widgets);

            var removeMe = _biggyWidgetList.FirstOrDefault();

            _biggyWidgetList.Remove(removeMe);
            _biggyWidgetList = new BiggyList <Widget>(_widgets);
            Assert.True(_biggyWidgetList.Count() == 0);
        }
Esempio n. 9
0
        public void Updates_Item_In_List_And_Store()
        {
            _biggyWidgetList.Clear();
            var updateMe = _biggyWidgetList.Add(new Widget {
                SKU = "001", Name = "Test widget 1", Price = 2.00M
            });

            // Update and Save:
            updateMe.Name = "UPDATED";
            _biggyWidgetList.Update(updateMe);

            // Reload the list:
            _biggyWidgetList = new BiggyList <Widget>(_widgets);

            // Grab from the list:
            var updatedInList = _biggyWidgetList.FirstOrDefault(w => w.Name == "UPDATED");

            // Make sure updated in both:
            Assert.True(updatedInList.Name == "UPDATED");
        }
Esempio n. 10
0
        public void Updates_Item_From_List_And_Store()
        {
            // Just in case:
            _clients.Clear();
            var newClient = new Client()
            {
                LastName = "Atten", FirstName = "John", Email = "*****@*****.**"
            };

            _clients.Add(newClient);
            _clients = new BiggyList <Client>(new PGStore <Client>(_connectionStringName));
            var updateMe = _clients.FirstOrDefault();

            updateMe.LastName = "Appleseed";
            _clients.Update(updateMe);

            // Open a new instance, to see if the item was added to the backing store as well:
            var altClientList = new BiggyList <Client>(new PGStore <Client>(_connectionStringName));
            var updated       = altClientList.FirstOrDefault(c => c.LastName == "Appleseed");

            Assert.True(updated != null && updated.LastName == "Appleseed");
        }
Esempio n. 11
0
        public void Updates_Item_From_List_And_Store()
        {
            // Just in case:
              _clients.Clear();
              var newClient = new Client() { LastName = "Atten", FirstName = "John", Email = "*****@*****.**" };
              _clients.Add(newClient);
              _clients = new BiggyList<Client>(_clientStore);
              var updateMe = _clients.FirstOrDefault();
              updateMe.LastName = "Appleseed";
              _clients.Update(updateMe);

              // Open a new instance, to see if the item was added to the backing store as well:
              var altClientList = new BiggyList<Client>(new SQLServerStore<Client>(_connectionStringName));
              var updated = altClientList.FirstOrDefault(c => c.LastName == "Appleseed");
              Assert.True(updated != null && updated.LastName == "Appleseed");
        }
        public void Updates_Item_In_List_But_Not_Store()
        {
            _biggyMemoryList = new BiggyList<Widget>(_widgetStore, inMemory: true);
              var updateMe = _biggyMemoryList.FirstOrDefault(w => w.SKU == "001");

              // Update and Save:
              updateMe.Name = "UPDATED";
              _biggyMemoryList.Update(updateMe);

              // Grab from the list:
              var updatedInList = _biggyMemoryList.FirstOrDefault(w => w.SKU == "001");
              var storeWidgets = _widgetStore.Load();
              var originalSotreWidget = storeWidgets.FirstOrDefault(w => w.SKU == "001");

              // Make sure updated in List, but not store:
              Assert.True(updatedInList.Name == "UPDATED" && originalSotreWidget.Name != "UPDATED");
        }
        public void Removes_Item_From_List_But_Not_Store()
        {
            _biggyMemoryList = new BiggyList<Widget>(_widgetStore, inMemory: true);

              var removeMe = _biggyMemoryList.FirstOrDefault();
              _biggyMemoryList.Remove(removeMe);
              var storeWidgets = _widgetStore.Load();
              Assert.True(_biggyMemoryList.Count() == INSERT_QTY -1 && storeWidgets.Count == INSERT_QTY);
        }
        public void Updates_Document_With_Serial_PK()
        {
            var newCustomer = new ClientDocument {
            Email = "*****@*****.**",
            FirstName = "Rob",
            LastName = "Conery"
              };
              _clientDocuments.Add(newCustomer);
              int idToFind = newCustomer.ClientDocumentId;

              // Go find the new record after reloading:
              _clientDocuments = new BiggyList<ClientDocument>(new SqlCeDocumentStore<ClientDocument>(_connectionStringName));
              var updateMe = _clientDocuments.FirstOrDefault(cd => cd.ClientDocumentId == idToFind);
              // Update:
              updateMe.FirstName = "Bill";
              _clientDocuments.Update(updateMe);

              // Go find the updated record after reloading:
              _clientDocuments = new BiggyList<ClientDocument>(new SqlCeDocumentStore<ClientDocument>(_connectionStringName));
              var updated = _clientDocuments.FirstOrDefault(cd => cd.ClientDocumentId == idToFind);
              Assert.True(updated.FirstName == "Bill");
        }
Esempio n. 15
0
        public void Removes_Item_From_List_And_Store()
        {
            _biggyWidgetList.Clear();
              _biggyWidgetList.Add(new Widget { SKU = "001", Name = "Test widget 1", Price = 2.00M });

              // Reload:
              _biggyWidgetList = new BiggyList<Widget>(_widgets);

              var removeMe = _biggyWidgetList.FirstOrDefault();
              _biggyWidgetList.Remove(removeMe);
              _biggyWidgetList = new BiggyList<Widget>(_widgets);
              Assert.True(_biggyWidgetList.Count() == 0);
        }
Esempio n. 16
0
        public void Updates_Item_In_List_And_Store()
        {
            _biggyWidgetList.Clear();
              var updateMe = _biggyWidgetList.Add(new Widget { SKU = "001", Name = "Test widget 1", Price = 2.00M });

              // Update and Save:
              updateMe.Name = "UPDATED";
              _biggyWidgetList.Update(updateMe);

              // Reload the list:
              _biggyWidgetList = new BiggyList<Widget>(_widgets);

              // Grab from the list:
              var updatedInList = _biggyWidgetList.FirstOrDefault(w => w.Name == "UPDATED");

              // Make sure updated in both:
              Assert.True(updatedInList.Name == "UPDATED");
        }