public void CreateCustomer_ShouldTryToWriteCustomerToDatabaseCheckUsingRoundTrip()
        {
            //Arrange
            var customer = new Customer()
                               {
                                   CountryID = 10,
                                   StateID = 5,
                                   Email = "DavidMZ",
                                   FirstName = "Firstname",
                                   Password = "******",
                                   LastName = "LastName",
                                   Phone = "12345"

                               };

            var customerService = new DataBaseCustomerAccountService(mapper);
            //Act
            var result = customerService.CreateCustomer(customer);
            //Assert
            result.Should().Be(MembershipCreateStatus.Success);

            var customerRoundTrip = customerService.GetCustomerByEmail(customer.Email);

            customerRoundTrip.CountryID.Should().Be(customer.CountryID);
            customerRoundTrip.Email.Should().Be(customer.Email);
            customerRoundTrip.FirstName.Should().Be(customer.FirstName);
            customerRoundTrip.LastName.Should().Be(customer.LastName);
            customerRoundTrip.StateID.Should().Be(customer.StateID);
            customerRoundTrip.Phone.Should().Be(customer.Phone);
        }
        public MembershipCreateStatus CreateCustomer(Customer customer)
        {
            var customerdto = mapper.Map<Customer, usr_CUSTOMERS>(customer);
            try
            {
                using (var db = new JONEntities())
                {
                    db.usr_CUSTOMERS.AddObject(customerdto);
                    db.SaveChanges();

                    return MembershipCreateStatus.Success;
                }
            }
            catch (Exception ex)
            {
                return MembershipCreateStatus.ProviderError;
            }
        }
        public void Signin(string email, Customer userData)
        {
            var encodedString = JsonConvert.SerializeObject(userData);

            var authTicket = new FormsAuthenticationTicket(
                1, //version
                email, // user name
                DateTime.Now,             //creation
                DateTime.Now.AddMinutes(30), //Expiration
                true, encodedString
                //Persistent
                ); //since Classic logins don't have a "Friendly Name".  OpenID logins are handled in the AuthController.

            string encTicket = FormsAuthentication.Encrypt(authTicket);
            var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);

            httpContext.Response.Cookies.Add(cookie);
            httpContext.Request.Cookies.Add(cookie);
        }
        private static IAuthentication CreateAuthenticationWithCustomerDataAndSignedInSetTo( bool isSignedIn,Customer customerData)
        {
            var authentication = MockRepository.GenerateStub<IAuthentication>();
            authentication.Stub(x => x.IsSignedIn()).Return(isSignedIn);

            authentication.Stub(x => x.CustomerData).Return(customerData);
            return authentication;
        }
示例#5
0
        public MailMessage NewCustomer(Customer customer)
        {
            var mailMessage = new MailMessage { Subject = "Thank you for registering to JewelryONet" };

            mailMessage.To.Add(customer.Email);
            mailMessage.From = serviceSender;

            mailMessage = ToSendACopyOfThisMailToSystemAddBCCFields(mailMessage);

            ViewBag.Password = customer.Password;
            ViewBag.Name = customer.FirstName + " " + customer.LastName;
            ViewBag.Email = customer.Email;

            PopulateBody(mailMessage, "NewCustomer");

            return mailMessage;
        }
 public MembershipCreateStatus CreateCustomer(Customer customer)
 {
     throw new NotImplementedException();
 }