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");
        }
示例#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");
        }
示例#3
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");
        }
示例#4
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");
        }
示例#5
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 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");
        }