public void ToUpdateQuery_Should_Create_UpdateQuery_With_4_Settings_And_1_Constraint_For_Product() { var provider = ProviderFactory.GetProvider("WestWind"); var id = Guid.NewGuid(); Product p = new Product(); p.ProductID = 1; p.ProductName = "Test"; p.Sku = id; p.Discontinued = false; p.UnitPrice = 100.00M; var qry = p.ToUpdateQuery(provider); Assert.NotNull(qry); Assert.IsType(typeof(Update<Product>), qry); Update<Product> update = (Update<Product>)qry; Assert.Equal(5, update.Settings.Count); Assert.Equal(1, update.Constraints.Count); Assert.Equal(p.ProductID, update.Constraints[0].ParameterValue); }
public void ToInsertQuery_Should_Create_InsertQuery_With_4_Settings_And_1_Constraint_For_Product() { var provider = ProviderFactory.GetProvider("WestWind"); Product p = new Product(); p.ProductID = 1; p.ProductName = "Test"; p.Sku = Guid.NewGuid(); p.Discontinued = false; p.UnitPrice = 100.00M; var qry = p.ToInsertQuery(provider); Assert.NotNull(qry); Assert.IsType(typeof(Insert), qry); Insert insert = (Insert)qry; Assert.Equal(5, insert.Inserts.Count); }