Example #1
0
 public void TestList()
 {
     int limit = 5, page = 1;
     Customer customer = new Customer();
     customer.Page = page++;
     customer.Limit = limit;
     Customer[] results = (Customer[]) customer.Read<Customer[]>();
     Assert.AreEqual(limit, results.Length);
 }
Example #2
0
        public void TestReadById()
        {
            Customer customer = new Customer();
            customer.ID = "1";
            Customer[] results = (Customer[]) customer.Read<Customer>();

            Assert.AreEqual(1, results.Length);

            Customer result = results[0];
            Assert.AreEqual(customer.ID, customer.ID);
        }
Example #3
0
        public void TestSearch()
        {
            string search = "Smith";
            Customer customer = new Customer();
            customer.LastName = search;

            Customer[] results = (Customer[]) customer.Read<Customer>();
            Assert.IsTrue(results.Length > 1);

            foreach (Customer o in results) {
                Assert.IsTrue(o.LastName.Contains(search));
            }
        }
Example #4
0
 public bool Exists()
 {
     if (string.IsNullOrWhiteSpace(this.FirstName)) throw new InvalidProgramException("Must specify name in Customer.Exists()");
     Customer customer = new Customer();
     customer.FirstName = this.FirstName;
     customer.LastName = this.LastName;
     customer.AddressLine1 = this.AddressLine1;
     customer.AddressLine1 = this.AddressLine2;
     customer.CityName = this.CityName;
     customer.RegionName = this.RegionName;
     customer.Postcode = this.Postcode;
     Customer[] customers = (Customer[]) customer.Read<Customer[]>();
     if (customers.Length > 0 && ! string.IsNullOrWhiteSpace(customers[0].FirstName)) return true;
     else return false;
 }
Example #5
0
 public void TestUpdate()
 {
     Customer customer = new Customer();
     customer.CustomerNumber = "1";
     customer.Update();
 }
Example #6
0
 public void TestDelete()
 {
     Customer customer = new Customer();
     customer.CustomerNumber = "1";
     customer.Delete();
 }
Example #7
0
 public object TestCreate()
 {
     Customer customer = new Customer(Warehouse.Random.Customer);
     customer.Create();
     return customer;
 }