public void T_CRUD_1() { var pr = new PeopleRepository(this.DbName); TestContext.WriteLine("{0}", pr.PathToSQLLiteDBFile); var model = Make(); TestContext.WriteLine("{0}", model.ToString()); var id = pr.AddUpdate(model); Assert.AreNotEqual(0, id, "Should not be zero"); Assert.IsTrue(pr.Exists(id), "Should exist"); model.NameLast = "Smith"; model.Id = id; var id2 = pr.AddUpdate(model); var model2 = pr.GetById(id); TestContext.WriteLine("{0}", model2.ToString()); Assert.IsNotNull(model2, "Model should not be null"); Assert.AreEqual(model2.Id, id, "ID"); Assert.AreEqual(model.Birthday.Year, model2.Birthday.Year, "Birthday"); Assert.AreEqual(model.Company, model2.Company, "Company"); Assert.AreEqual(model.EMail, model2.EMail, "EMail"); Assert.AreEqual(model.NameFirst, model2.NameFirst, "NameFirst"); Assert.AreEqual(model.NameLast, model2.NameLast, "NameLast"); pr.Delete(id); var model3 = pr.GetById(id); Assert.IsNull(model3, "Should be null post delete"); }
public void T_Collection_1() { var pr = new PeopleRepository(this.DbName); var model = Make(); model.NameLast = "Ede"; pr.AddUpdate(model); pr.AddUpdate(Make()); pr.AddUpdate(Make()); pr.AddUpdate(Make()); pr.AddUpdate(Make()); pr.AddUpdate(Make()); pr.AddUpdate(Make()); var result = pr.Search("e"); var list = new List <Models.Person>(); list.AddRange(result); Assert.IsTrue((list.Count > 0), "Should have at least one result"); }