コード例 #1
0
        public void AuthenticateCustomerTest()
        {
            //Arrange
            var seedDB = new List <CustomerModelDAL>();
            var seed   = new CustomerModelDAL
            {
                Email     = "*****@*****.**",
                Password  = PasswordHelperTool.PasswordSHA256Hasher("password"),
                FirstName = "First",
                LastName  = "Last"
            };

            seedDB.Add(seed);
            var controller  = new CustomerUsersLogic(new CustomerDALStub(seedDB));
            var rightInput1 = "*****@*****.**";
            var rightInput2 = "password";
            var wrongInput1 = "";
            var wrongInput2 = "";

            //Act
            var result1 = controller.AuthenticateCustomer(rightInput1, rightInput2);
            var result2 = controller.AuthenticateCustomer(wrongInput1, wrongInput2);

            //Assert
            Assert.IsTrue(result1 && !result2);
        }
コード例 #2
0
        public void GetAllTest()
        {
            //Arrange
            var seedDB = new List <CustomerModelDAL>();
            var seed   = new CustomerModelDAL
            {
                Email     = "*****@*****.**",
                Password  = PasswordHelperTool.PasswordSHA256Hasher("password"),
                FirstName = "First",
                LastName  = "Last"
            };

            seedDB.Add(seed);
            var controller = new CustomerUsersLogic(new CustomerDALStub(seedDB));

            //Act
            var result = controller.GetAll();

            //Assert
            Assert.IsNotNull(result); //Double check
        }
コード例 #3
0
        public void UpdateTest()
        {
            var seedDB = new List <CustomerModelDAL>();
            var seed   = new CustomerModelDAL
            {
                Email     = "*****@*****.**",
                Password  = PasswordHelperTool.PasswordSHA256Hasher("password"),
                FirstName = "First",
                LastName  = "Last"
            };

            seedDB.Add(seed);
            //Arrange
            var controller = new CustomerUsersLogic(new CustomerDALStub(seedDB));
            var rightInput = new CustomerModelBLL
            {
                Email        = "*****@*****.**",
                Password     = "******",
                FirstName    = "First",
                LastName     = "Last",
                MovieRentals = null
            };
            var wrongInput = new CustomerModelBLL
            {
                Email        = "",
                Password     = "",
                FirstName    = "",
                LastName     = "",
                MovieRentals = null
            };

            //Act
            var result1 = controller.Create(rightInput);
            var result2 = controller.Create(wrongInput);

            //Assert
            Assert.IsTrue(result1 && !result2);
        }
コード例 #4
0
 public HomeController()
 {
     _moviesLogic        = new MoviesLogic();
     _customerUsersLogic = new CustomerUsersLogic();
     _movieOrdersLogic   = new MovieOrdersLogic();
 }
コード例 #5
0
 public CustomerAdministrationController()
 {
     _customerUsersLogic = new CustomerUsersLogic();
 }
コード例 #6
0
 public MyPageController()
 {
     _customerUserLogic = new CustomerUsersLogic();
 }