public void Execute_002() { var expected = new Person { ID = Guid.Parse("9d12a0f4-6494-4d58-bee4-c7a99a287c1c"), FirstName = "Chris", LastName = "Pietschmann", Age = 1065 }; using (var con = GetDBConnection()) { con.Open(); var trans = con.BeginTransaction(); try { var query = new SQLinqUpdate<Person>(expected); con.Execute(query, trans); var actual = con.Query(from p in new SQLinq<Person>() where p.ID == expected.ID select p, trans).FirstOrDefault(); Assert.IsNotNull(actual); Assert.AreEqual(expected.ID, actual.ID); Assert.AreEqual(expected.FirstName, actual.FirstName); Assert.AreEqual(expected.LastName, actual.LastName); Assert.AreEqual(expected.Age, actual.Age); } finally { trans.Rollback(); con.Close(); } } }
public void Execute_001() { var expected = new Person { ID = Guid.NewGuid(), FirstName = "Steven", LastName = "Johnston", Age = 1065 }; using (var con = GetDBConnection()) { con.Open(); var trans = con.BeginTransaction(); try { var query = new SQLinqInsert<Person>(expected); con.Execute(query, trans); var actual = con.Query(from p in new SQLinq<Person>() where p.ID == expected.ID select p, trans).FirstOrDefault(); Assert.IsNotNull(actual); Assert.AreEqual(expected.ID, actual.ID); Assert.AreEqual(expected.FirstName, actual.FirstName); Assert.AreEqual(expected.LastName, actual.LastName); Assert.AreEqual(expected.Age, actual.Age); } finally { trans.Rollback(); con.Close(); } } }