示例#1
0
        public void MasterList_GetAllCustomersInList_ShouldSucceed()
        {
            //act
            _masterListMethods.AddCustomerToMasterList(newPastCustomer);
            _masterListMethods.GetAllCustomers();

            //assert
            Assert.AreEqual(1, _masterListMethods.GetAllCustomers().Count);
        }
示例#2
0
        public void CreateCustomer()
        {
            try
            {
                _console.WriteLine("What type of customer are you creating?\n" +
                                   "1. Past\n" +
                                   "2. Present\n" +
                                   "3. Potential");
                var command = _console.ReadLine();
                if (command == "1")
                {
                    _console.WriteLine("Enter full name:");
                    var nameInput = _console.ReadLine();

                    _console.WriteLine("Enter street address:");
                    var streetAddressInput = _console.ReadLine();

                    _console.WriteLine("Enter city:");
                    var cityInput = _console.ReadLine();

                    _console.WriteLine("Enter state:");
                    var stateInput = _console.ReadLine();

                    _console.WriteLine("Enter zipcode:");
                    var zipCodeInput = Convert.ToInt32(_console.ReadLine());

                    var newPastCustomer = PastCustomerRepo.CreatePastCustomer(nameInput, streetAddressInput, cityInput, stateInput, zipCodeInput);
                    MasterList.AddCustomerToMasterList(newPastCustomer);
                    PastCustomerRepo.AddPastCustomerToList(newPastCustomer);
                    _console.WriteLine("Created customer");
                }
                if (command == "2")
                {
                    _console.WriteLine("Enter full name:");
                    var nameInput = _console.ReadLine();

                    _console.WriteLine("Enter street address:");
                    var streetAddressInput = _console.ReadLine();

                    _console.WriteLine("Enter city:");
                    var cityInput = _console.ReadLine();

                    _console.WriteLine("Enter state:");
                    var stateInput = _console.ReadLine();

                    _console.WriteLine("Enter zipcode:");
                    var zipCodeInput = Convert.ToInt32(_console.ReadLine());

                    var newPresentCustomer = PresentCustomerRepo.CreatePresentCustomer(nameInput, streetAddressInput, cityInput, stateInput, zipCodeInput);
                    MasterList.AddCustomerToMasterList(newPresentCustomer);
                    PresentCustomerRepo.AddPresentCustomerToList(newPresentCustomer);
                    _console.WriteLine("Created customer");
                }
                if (command == "3")
                {
                    _console.WriteLine("Enter full name:");
                    var nameInput = _console.ReadLine();

                    _console.WriteLine("Enter street address:");
                    var streetAddressInput = _console.ReadLine();

                    _console.WriteLine("Enter city:");
                    var cityInput = _console.ReadLine();

                    _console.WriteLine("Enter state:");
                    var stateInput = _console.ReadLine();

                    _console.WriteLine("Enter zipcode:");
                    var zipCodeInput = Convert.ToInt32(_console.ReadLine());

                    var newPotentialCustomer = PotentialCustomerRepo.CreatePotentialCustomer(nameInput, streetAddressInput, cityInput, stateInput, zipCodeInput);
                    MasterList.AddCustomerToMasterList(newPotentialCustomer);
                    PotentialCustomerRepo.AddPotentalCustomerToList(newPotentialCustomer);
                    _console.WriteLine("Created customer");
                }
                else
                {
                    _console.WriteLine("Please enter a valid number");
                }
            }
            catch (ArgumentException ex)
            {
                _console.WriteLine(ex.Message);
            }
        }