コード例 #1
0
        public void AddCustomer_ShouldGetNotNull()
        {
            Greetings     newGreetings = new Greetings("Tom", "Smith", CustomerType.Current);
            GreetingsRepo repository   = new GreetingsRepo();

            repository.AddCustomerGreeting(newGreetings);
            Greetings fromDirectory = repository.GetCustomerByFullName("Smith", "Tom");

            Assert.IsNotNull(fromDirectory);
        }
コード例 #2
0
 public void Arrange()
 {
     _greeting      = new Greetings("John", "Smith", CustomerType.Past);
     _greetingsRepo = new GreetingsRepo();
     _greetingsRepo.AddCustomerGreeting(_greeting);
 }
コード例 #3
0
        private void AddNewCustomer()
        {
            Console.WriteLine("What is the customer's first name?");
            string fName = Console.ReadLine();

            Console.WriteLine("What is the customer's last name?");
            string lName = Console.ReadLine();

            Console.WriteLine($"\nWhat type of customer is {fName} {lName}?\n" +
                              "1. Current customer\n" +
                              "2. Past customer\n" +
                              "3. Potential customer\n" +
                              "Please enter 1, 2, or 3");
            string       newCustInput = Console.ReadLine();
            CustomerType newType      = CustomerType.Potential;

            switch (newCustInput)
            {
            case "1":
                newType = CustomerType.Current;
                break;

            case "2":
                newType = CustomerType.Past;
                break;

            case "3":
                newType = CustomerType.Potential;
                break;

            default:
                Console.WriteLine("Please enter a valid number");
                break;
            }
            Greetings newGreetings = new Greetings(fName, lName, newType);

            _greetingsRepo.AddCustomerGreeting(newGreetings);
            Console.WriteLine($"{fName} {lName}, a {newType} customer, has been added to the email list.");
        }