示例#1
0
        public void ValidateCustomer()
        {
            //KF: In a full solution each piece of validation could have its own test.
            //The validation could return a collection of specific error numbers that the
            //routines here would check for.  So instead of using a StringBuilder the
            //validation functions would return a collection of errors.

            frmCustomer frm = new frmCustomer();

            frm.CustomerId = Guid.Parse("88A96958-A302-4913-9ADC-1997B49C7571");
            frm.LoadData();
            //KF: Should be able to implement a way of finding controls by name or by tag
            frm.txtFirstName.Text = "";
            frm.txtLastName.Text  = "";

            GenesisModels.Customer modelCustomer = new GenesisModels.Customer();
            modelCustomer.Id        = Guid.Parse("88A96958-A302-4913-9ADC-1997B49C7571");
            modelCustomer.FirstName = "Kevin";
            modelCustomer.LastName  = "Finegan";

            Bus.Customer customer = new Bus.Customer(modelCustomer);

            frm.SuppressMessages = true;
            Assert.IsFalse(frm.ValidateData(customer));

            customer = null;
        }
示例#2
0
        public void UpdateCustomer()
        {
            GenesisModels.Customer modelCustomer = new GenesisModels.Customer();
            modelCustomer.Id        = Guid.Parse("88A96958-A302-4913-9ADC-1997B49C7571");
            modelCustomer.FirstName = "Kevin";
            modelCustomer.LastName  = "Finegan";

            Bus.Customer customer = new Bus.Customer(modelCustomer);

            customer.Update();

            customer = null;
        }
示例#3
0
        public void ValidateDuplicateCustomer()
        {
            frmCustomer frm = new frmCustomer();

            frm.CustomerId = Guid.Parse("A0A21498-8538-4539-9F44-B283803AFD1C");
            frm.LoadData();
            frm.txtFirstName.Text = "Kevin";
            frm.txtLastName.Text  = "Finegan";

            GenesisModels.Customer modelCustomer = new GenesisModels.Customer();
            modelCustomer.Id        = Guid.Parse("A0A21498-8538-4539-9F44-B283803AFD1C");
            modelCustomer.FirstName = "Kevin";
            modelCustomer.LastName  = "Finegan";

            Bus.Customer customer = new Bus.Customer(modelCustomer);

            frm.SuppressMessages = true;
            Assert.IsFalse(frm.SaveData());

            customer = null;
        }