示例#1
0
        public void AddsCustomerToDb()
        {
            //Arrange
            var          options = BuildInMemoryDb("AddsCustomer");
            string       fName = "Bob", lName = "Dole", email = "*****@*****.**";
            CustomerInfo customerInfo = null;

            //Act
            using (var context = new P0DbContext(options))
            {
                var backend = new StoreBackend(context);
                customerInfo = backend.AddNewCustomer(fName, lName, email);
            }
            //Assert
            using (var context = new P0DbContext(options))
            {
                var customer = (from c in context.Customers
                                where c.FirstName == fName && c.LastName == lName
                                select c).Take(1).FirstOrDefault();

                Assert.Equal(customer.CustomerId, customerInfo.CustomerId);
                Assert.Equal(fName, customer.FirstName);
                Assert.Equal(lName, customer.LastName);
                Assert.Equal(email, customer.Email);
            }
        }
示例#2
0
        private bool RegisterNewUser()
        {
            var okToContinue = true;

            Console.Write("Enter first name: ");
            var firstName = utils.ProcessInput();

            Console.Write("Enter last name: ");
            var lastName = utils.ProcessInput();

            Console.Write("Enter email address: ");
            var email = utils.ProcessInput();

            //Send this information to the backend api
            customer = db.AddNewCustomer(firstName, lastName, email);

            return(okToContinue);
        }