public void ToSQL_006() { var data = new PersonInsert { FirstName = "Chris", LastName = "Pietschmann" }; var target = data.ToSQLinqInsert(); var actual = (SQLinqInsertResult)target.ToSQL(42, "foo"); Assert.AreEqual("[PersonInsert]", actual.Table); Assert.AreEqual(6, actual.Fields.Count); Assert.AreEqual("@foo43", actual.Fields["FirstName"]); Assert.AreEqual("@foo44", actual.Fields["LastName"]); Assert.AreEqual("@foo45", actual.Fields["Age"]); Assert.AreEqual("@foo46", actual.Fields["IsEmployed"]); Assert.AreEqual("@foo47", actual.Fields["ParentID"]); Assert.AreEqual("@foo48", actual.Fields["Column With Spaces"]); Assert.AreEqual(6, actual.Parameters.Count); Assert.AreEqual("Chris", actual.Parameters["@foo43"]); Assert.AreEqual("Pietschmann", actual.Parameters["@foo44"]); Assert.AreEqual(0, actual.Parameters["@foo45"]); Assert.AreEqual(false, actual.Parameters["@foo46"]); Assert.AreEqual(Guid.Empty, actual.Parameters["@foo47"]); Assert.AreEqual(null, actual.Parameters["@foo48"]); }
public void ToSQL_008() { var data = new PersonInsert { FirstName = "Chris", LastName = "Pietschmann" }; var guid = Guid.NewGuid(); var target = data.ToSQLinqUpdate(); target.Where(d => d.ID == guid); var actual = target.ToSQL(42, "foo").ToQuery(); var expected = "UPDATE [PersonInsert] SET [FirstName] = @foo43, [LastName] = @foo44, [Age] = @foo45, [IsEmployed] = @foo46, [ParentID] = @foo47, [Column With Spaces] = @foo48 WHERE [ID] = @foo49"; Assert.AreEqual(expected, actual); }