public T Add(T item) { item = _biggyStore.Add(item); _luceneIndexer.AddDocumentToIndex(item); return(item); }
public virtual T Add(T item) { _store.Add(item); _items.Add(item); Fire(ItemAdded, item: item); return(item); }
public virtual T Add(T item) { if (_store != null && !this.InMemory) { _store.Add(item); } _items.Add(item); Fire(ItemAdded, item: item); return(item); }
public void Adds_Item_To_Store() { _widgets.Clear(); _widgets.Add(new Widget { SKU = "001", Name = "Test widget 1", Price = 2.00M }); var itemsInStore = _widgets.Load(); Assert.True(itemsInStore.Count() > 0); }
public void Inserts_Record_With_Composite_PK() { var newBuilding = new Building { PropertyId = 1, BuildingId = 1, Name = "Building A" }; _buildingStore.Add(newBuilding); var fetchBuilding = _buildingStore.Load().First(); Assert.True(fetchBuilding.PropertyId == 1 && fetchBuilding.BuildingId == 1 && fetchBuilding.Name == "Building A"); }
public void Adds_Document_With_Composite_PK() { var newBuilding = new BuildingDocument { PropertyId = 1, BuildingId = 1, Name = "Building 1" }; buildingDocs.Add(newBuilding); var fetchBuilding = buildingDocs.Load().First(); Assert.True(fetchBuilding.Name == "Building 1"); }
public void IBiggyStore_Adds_Record() { _biggyStore = new PGStore<Client>(_connectionStringName); var newClient = new Client() { LastName = "Atten", FirstName = "John", Email = "*****@*****.**" }; _biggyStore.Add(newClient); Assert.True(newClient.ClientId > 0); }
public void Bulk_Inserts_Documents_With_String_PK() { int INSERT_QTY = 100; var addRange = new List <MonkeyDocument>(); for (int i = 0; i < INSERT_QTY; i++) { addRange.Add(new MonkeyDocument { Name = "MONKEY " + i, Birthday = DateTime.Today, Description = "The Monkey on my back" }); } monkeyDocs.Add(addRange); var inserted = monkeyDocs.Load(); Assert.True(inserted.Count() == INSERT_QTY); }
public void IBiggyStore_Adds_Record() { _biggyStore = new SqlCeStore <Client>(_connectionStringName); var newClient = new Client() { LastName = "Atten", FirstName = "John", Email = "*****@*****.**" }; _biggyStore.Add(newClient); Assert.True(newClient.ClientId > 0); }
public void Updates_Document_With_Serial_PK() { var newCustomer = new ClientDocument { Email = "*****@*****.**", FirstName = "Rob", LastName = "Conery" }; clientDocs.Add(newCustomer); int idToFind = newCustomer.ClientDocumentId; // Go find the new record after reloading: var updateMe = clientDocs.Load().FirstOrDefault(cd => cd.ClientDocumentId == idToFind); // Update: updateMe.FirstName = "Bill"; clientDocs.Update(updateMe); // Go find the updated record after reloading: var updated = clientDocs.Load().FirstOrDefault(cd => cd.ClientDocumentId == idToFind); Assert.True(updated.FirstName == "Bill"); }
public void IBiggyStore_Adds_Many_Records() { _biggyStore = new PGStore<Client>(_connectionStringName); var insertThese = new List<Client>(); for (int i = 0; i < 10; i++) { var newClient = new Client() { LastName = string.Format("LastName {0}", i), FirstName = "John", Email = "*****@*****.**" }; insertThese.Add(newClient); } _biggyStore.Add(insertThese); var newClients = _biggyStore.Load(); Assert.True(newClients.Count > 0); }
public void Adds_Document_With_Serial_PK() { var newCustomer = new ClientDocument { Email = "*****@*****.**", FirstName = "Rob", LastName = "Conery" }; IBiggyStore <ClientDocument> docStore = clientDocs as IBiggyStore <ClientDocument>; docStore.Add(newCustomer); docStore.Load(); Assert.Equal(1, docStore.Load().Count()); }
public void IBiggyStore_Adds_Many_Records() { _biggyStore = new SqlCeStore <Client>(_connectionStringName); var insertThese = new List <Client>(); for (int i = 0; i < 10; i++) { var newClient = new Client() { LastName = string.Format("LastName {0}", i), FirstName = "John", Email = "*****@*****.**" }; insertThese.Add(newClient); } _biggyStore.Add(insertThese); var newClients = _biggyStore.Load(); Assert.True(newClients.Count > 0); }
public void IUpdateableBiggyStore_Deletes_Record() { _biggyStore = new SqlCeStore <Client>(_connectionStringName); var newClient = new Client() { LastName = "Atten", FirstName = "John", Email = "*****@*****.**" }; _biggyStore.Add(newClient); // Stow the id so we can reload, then update (just to be SURE!!) int idToFind = newClient.ClientId; newClient = _biggyStore.Load().FirstOrDefault(c => c.ClientId == idToFind); var deleteMe = _biggyStore.Load().FirstOrDefault(c => c.ClientId == idToFind); _biggyStore.Remove(deleteMe); var clients = _biggyStore.Load(); Assert.True(clients.Count == 0); }
public void IUpdateableBiggyStore_Updates_Record() { _biggyStore = new SqlCeStore <Client>(_connectionStringName); var newClient = new Client() { LastName = "Atten", FirstName = "John", Email = "*****@*****.**" }; _biggyStore.Add(newClient); // Stow the id so we can reload, then update (just to be SURE!!) int idToFind = newClient.ClientId; newClient = _biggyStore.Load().FirstOrDefault(c => c.ClientId == idToFind); newClient.FirstName = "John Paul"; newClient.LastName = "Jones"; _biggyStore.Update(newClient); var updatedClient = _biggyStore.Load().FirstOrDefault(c => c.ClientId == idToFind); Assert.True(updatedClient.LastName == "Jones"); }
public void IBiggyDocumentStore_Add_A_Lot_Of_Records() { _clientDocs = new SqlCeDocumentStore <ClientDocument>(_connectionStringName); int recordsCnt = 500; List <ClientDocument> clients = new List <ClientDocument>(500); foreach (var i in Enumerable.Range(0, recordsCnt)) { clients.Add(new ClientDocument { Email = "client" + i + "@domain.com", FirstName = "client#" + i, LastName = "last#" + i }); } var result = _clientDocs.Add(clients); // check for Pks Assert.Equal(recordsCnt, result.Last().ClientDocumentId); var newList = _clientDocs.Load(); Assert.Equal(recordsCnt, newList.Count); }
public void IBiggyStore_Add_A_Lot_Of_Records() { _biggyStore = new SqlCeStore<Client>(_connectionStringName); int recordsCnt = 500; List<Client> clients = new List<Client>(500); foreach (var i in Enumerable.Range(0, recordsCnt)) { clients.Add(new Client { Email = "client" + i + "@domain.com", FirstName = "client#" + i, LastName = "last#" + i }); } var result = _biggyStore.Add(clients); // check for Pks Assert.Equal(recordsCnt, result.Last().ClientId); var newList = _biggyStore.Load(); Assert.Equal(recordsCnt, newList.Count); }
public void IUpdateableBiggyStore_Deletes_Record() { _biggyStore = new PGStore<Client>(_connectionStringName); var newClient = new Client() { LastName = "Atten", FirstName = "John", Email = "*****@*****.**" }; _biggyStore.Add(newClient); // Stow the id so we can reload, then update (just to be SURE!!) int idToFind = newClient.ClientId; newClient = _biggyStore.Load().FirstOrDefault(c => c.ClientId == idToFind); var deleteMe = _biggyStore.Load().FirstOrDefault(c => c.ClientId == idToFind); _biggyStore.Remove(deleteMe); var clients = _biggyStore.Load(); Assert.True(clients.Count == 0); }
public void IUpdateableBiggyStore_Updates_Record() { _biggyStore = new PGStore<Client>(_connectionStringName); var newClient = new Client() { LastName = "Atten", FirstName = "John", Email = "*****@*****.**" }; _biggyStore.Add(newClient); // Stow the id so we can reload, then update (just to be SURE!!) int idToFind = newClient.ClientId; newClient = _biggyStore.Load().FirstOrDefault(c => c.ClientId == idToFind); newClient.FirstName = "John Paul"; newClient.LastName = "Jones"; _biggyStore.Update(newClient); var updatedClient = _biggyStore.Load().FirstOrDefault(c => c.ClientId == idToFind); Assert.True(updatedClient.LastName == "Jones"); }