public List <Customer> GetCustomersByFirstNameOrLastName(string FirstName, string LastName) { CustomerBO customerBO = new CustomerBO(); List <Customer> customers = customerBO.GetCustomersByFirstNameOrLastName(FirstName, LastName); return(customers); }
public void GetCustomersByFirstNameOrLastName() { string FirstName; string LastName; CustomerBO customerBO = new CustomerBO(); List <Customer> customers = new List <Customer>(); // one from first name 2 from last name FirstName = "Fred"; LastName = "Flintstone"; customers = customerBO.GetCustomersByFirstNameOrLastName(FirstName, LastName); Assert.AreEqual(customers.Count, 2); // one from first name 2 from last name FirstName = "Fred"; LastName = ""; customers = customerBO.GetCustomersByFirstNameOrLastName(FirstName, LastName); Assert.AreEqual(customers.Count, 1); // one from first name 2 from last name FirstName = ""; LastName = "Flintstone"; customers = customerBO.GetCustomersByFirstNameOrLastName(FirstName, LastName); Assert.AreEqual(customers.Count, 2); // one from first name 2 from last name FirstName = "re"; LastName = "Flint"; customers = customerBO.GetCustomersByFirstNameOrLastName(FirstName, LastName); Assert.AreEqual(customers.Count, 0); // one from first name 2 from last name FirstName = "re"; LastName = "Flintstone"; customers = customerBO.GetCustomersByFirstNameOrLastName(FirstName, LastName); Assert.AreEqual(customers.Count, 2); // none from first name 2 from last name FirstName = null; LastName = "Flintstone"; customers = customerBO.GetCustomersByFirstNameOrLastName(FirstName, LastName); Assert.AreEqual(customers.Count, 2); // one from first name none from last name FirstName = "Fred"; LastName = null; customers = customerBO.GetCustomersByFirstNameOrLastName(FirstName, LastName); Assert.AreEqual(customers.Count, 1); // one from first name none from last name FirstName = null; LastName = null; customers = customerBO.GetCustomersByFirstNameOrLastName(FirstName, LastName); Assert.AreEqual(customers.Count, 0); // one from first name none from last name FirstName = ""; LastName = ""; customers = customerBO.GetCustomersByFirstNameOrLastName(FirstName, LastName); Assert.AreEqual(customers.Count, 0); }