public void DeleteCustomer(Customer customer) { const string sql = "DELETE FROM Customer WHERE ID = @id"; new FluentCommand<Customer>(sql) .AddGuid("id", customer.ID) .AsNonQuery(); }
public void Add_Test() { var cust = new Customer { FirstName = "Chris", LastName = "Brandsma", Birthday = new DateTime(1975, 4, 2) }; _dbo.AddCustomer(cust); Assert.IsNotNull(cust.ID); }
public void DeleteTest() { var cust = new Customer { FirstName = "Chris", LastName = "Brandsma", Birthday = new DateTime(1975, 4, 2) }; _dbo.AddCustomer(cust); Assert.AreEqual(1, _dbo.GetList().Count); _dbo.DeleteCustomer(cust); Assert.AreEqual(0, _dbo.GetList().Count); }
public void AddFullCustomer_Test() { var cust = new Customer { FirstName = "Chris", LastName = "Brandsma", Birthday = new DateTime(1975, 4, 2), Height = new decimal(6.2), Weight = 210 }; _dbo.AddCustomer(cust); Assert.IsNotNull(cust.ID); }
public void AddCustomer(Customer customer) { customer.ID = Guid.NewGuid(); const string sql = @"INSERT INTO Customer (ID, FirstName, LastName, BirthDay, Height, Weight) VALUES (@id,@firstName,@lastName,@birthday,@height,@weight)"; new FluentCommand<string>(sql) .AddGuid("id", customer.ID) .AddString("firstName", customer.FirstName) .AddString("lastName", customer.LastName) .AddDateTime("birthday", customer.Birthday) .AddDecimal("height", customer.Height) .AddInt("weight", customer.Weight) .AsNonQuery(); }
public void AddListOfCustomers() { var cust = new Customer { FirstName = "Chris", LastName = "Brandsma", Birthday = new DateTime(1975, 4, 2), Height = new decimal(6.2), Weight = 210 }; var list = new List<Customer>(); for (int i = 0; i < 20; i++) { list.Add(cust); } _dbo.AddCustomerList(list); }
public void Enumerator_Test() { var cust = new Customer { FirstName = "Chris", LastName = "Brandsma", Birthday = new DateTime(1975, 4, 2) }; _dbo.AddCustomer(cust); _dbo.AddCustomer(cust); _dbo.AddCustomer(cust); var list = _dbo.GetEnumerable(); Assert.AreEqual(3, list.Count()); }
public void JustIdAndNameTest() { var cust = new Customer { FirstName = "Chris", LastName = "Brandsma", Birthday = new DateTime(1975, 4, 2), Height = new decimal(6.2), Weight = 210 }; _dbo.AddCustomer(cust); var list = _dbo.JustIdAndName(); Assert.AreEqual(1, list.Count); }
public void GetById_Test() { var cust = new Customer { FirstName = "Chris", LastName = "Brandsma", Birthday = new DateTime(1975, 4, 2) }; _dbo.AddCustomer(cust); var newCust = _dbo.ByID(cust.ID); Assert.AreEqual(cust.ID, newCust.ID); Assert.AreEqual(cust.FirstName, newCust.FirstName); Assert.AreEqual(cust.LastName , newCust.LastName); }