public void Adds_New_Record() { int initialCount = _MismatchedClients.Count; var newMonkey = new MismatchedClient() { Last = "Jimbo", First = "Jones", EmailAddress = "*****@*****.**" }; _MismatchedClients.Add(newMonkey); int newID = newMonkey.Id; _MismatchedClients = new PGList<MismatchedClient>(_connectionStringName, "wtf"); var found = _MismatchedClients.FirstOrDefault(c => c.Id == newID); Assert.True(found.Id == newID && _MismatchedClients.Count > initialCount); }
public void Deletes_Range_Of_Records() { var newMismatchedClient = new MismatchedClient() { First = "John", Last = "Atten", EmailAddress = "*****@*****.**" }; _MismatchedClients.Add(newMismatchedClient); _MismatchedClients.Reload(); int initialCount = _MismatchedClients.Count; var removeThese = _MismatchedClients.Where(c => c.EmailAddress.Contains("*****@*****.**")); _MismatchedClients.RemoveSet(removeThese); Assert.True(_MismatchedClients.Count < initialCount); }
public void Bulk_Inserts_Records() { int initialCount = _MismatchedClients.Count(); var rangeToAdd = new List<MismatchedClient>(); for(int i = 0; i < _qtyInserted; i++) { var newCustomer = new MismatchedClient() { First = string.Format("John{0}", i.ToString()), Last = "Atten", EmailAddress = "*****@*****.**" }; rangeToAdd.Add(newCustomer); } int qtyAdded = _MismatchedClients.AddRange(rangeToAdd); _MismatchedClients.Reload(); Assert.True(_MismatchedClients.Count == initialCount + _qtyInserted); }
public void Deletes_Record() { var newCustomer = new MismatchedClient() { First = "John", Last = "Atten", EmailAddress = "*****@*****.**" }; _MismatchedClients.Add(newCustomer); int idToFind = newCustomer.Id; _MismatchedClients.Reload(); var found = _MismatchedClients.FirstOrDefault(c => c.Id == idToFind); // After insert, no new record should be added: int initialCount = _MismatchedClients.Count(); _MismatchedClients.Remove(found); _MismatchedClients.Reload(); Assert.True(_MismatchedClients.Count < initialCount); }
public void Updates_Record() { var newMonkey = new MismatchedClient() { Last = "Jones", First = "Davey", EmailAddress = "*****@*****.**" }; _MismatchedClients.Add(newMonkey); int currentCount = _MismatchedClients.Count; int newID = newMonkey.Id; _MismatchedClients = new PGList<MismatchedClient>(_connectionStringName, "wtf"); var found = _MismatchedClients.FirstOrDefault(c => c.Id == newID); found.First = "Mick"; _MismatchedClients.Update(found); Assert.True(found.Id == newID && _MismatchedClients.Count == currentCount); }