Beispiel #1
0
        public void GetsCustomerByEmail()
        {
            //Arrange
            var    options = BuildInMemoryDb("GetsCustomer");
            string fName = "Bob", lName = "Dole", email = "*****@*****.**";

            //Act
            using (var context = new P0DbContext(options))
            {
                var customer = new Customer
                {
                    FirstName = fName,
                    LastName  = lName,
                    Email     = email
                };
                context.Add(customer);
                context.SaveChanges();
            }
            //Assert
            using (var context = new P0DbContext(options))
            {
                var backend      = new StoreBackend(context);
                var customerInfo = backend.GetCustomerInfo(email);

                Assert.Equal(fName, customerInfo.FirstName);
                Assert.Equal(lName, customerInfo.LastName);
                Assert.Equal(email, customerInfo.Email);
            }
        }
Beispiel #2
0
        private bool LoginUser()
        {
            var okToContinue = true;

            var email = string.Empty;

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

            while (!IsValidEmail(email))
            {
                Console.WriteLine("Please enter a valid email address.");
                email = utils.ProcessInput();
            }
            ;

            //retrieve the user information from the backend api
            customer = db.GetCustomerInfo(email);
            if (customer == null)
            {
                okToContinue = false;
                Console.Write("Unable to find an account linked to that email. Press any key to return to the previous menu. ");
                Console.ReadLine();
            }
            return(okToContinue);
        }