Ejemplo n.º 1
0
        public void Login_getall_returns_multiple_test()
        {
            Facade facade = new Facade();
            Customer cusOne = new Customer()
            {
                FirstName = "Jonas Olesen",
                Address = "Møbelvej 3",
                BirthDate = DateTime.Now.AddYears(-20),
                Email = "*****@*****.**",
                PhoneNumber = 22755692
            };
            cusOne = facade.GetCustomerRepo().Add(cusOne);

            Login login = new Login() { Customer = cusOne, Password = "******", Username = "******"+Id++ };
            facade.GetLoginRepo().Add(login);
            Login login2 = new Login() { Customer = cusOne, Password = "******", Username = "******"+Id++ };
            facade.GetLoginRepo().Add(login2);

            facade = new Facade();
            Assert.GreaterOrEqual(facade.GetLoginRepo().GetAll().ToList().Count, 2);
        }
Ejemplo n.º 2
0
        public void Login_add_creates_on_call_using_get_test()
        {
            Facade facace = new Facade();
            Customer cusOne = new Customer()
            {
                FirstName = "Jonas Olesen",
                Address = "Møbelvej 3",
                BirthDate = DateTime.Now.AddYears(-20),
                Email = "*****@*****.**",
                PhoneNumber = 22755692
            };
            cusOne = facace.GetCustomerRepo().Add(cusOne);
            Login login = new Login() { Customer = cusOne, Password = "******", Username = "******" + Id++ };
            login = facace.GetLoginRepo().Add(login);

            facace = new Facade();
            Assert.AreEqual(facace.GetLoginRepo().Get(login.Username).Password, login.Password);
        }
Ejemplo n.º 3
0
 public void Login_get_customer_returns_null_on_wrong_username_test()
 {
     Facade facade = new Facade();
     Assert.IsNull(facade.GetLoginRepo().GetCustomerByLoginUsername("fejl"));
 }
Ejemplo n.º 4
0
        public void Login_get_customer_by_login_returns_right_customer_test()
        {
            Facade facade = new Facade(); Customer cusOne = new Customer()
            {
                FirstName = "Jonas Olesen",
                Address = "Møbelvej 3",
                BirthDate = DateTime.Now.AddYears(-20),
                Email = "*****@*****.**",
                PhoneNumber = 22755692
            };
            cusOne = facade.GetCustomerRepo().Add(cusOne);

            Login login = new Login() { Customer = cusOne, Password = "******", Username = "******"+Id++ };
            login = facade.GetLoginRepo().Add(login);

            Assert.AreEqual(facade.GetLoginRepo().GetCustomerByLoginUsername(login.Username).FirstName, login.Customer.FirstName);
        }
Ejemplo n.º 5
0
 public void Login_add_throws_exception_on_login_equals_null_test()
 {
     Facade facade = new Facade();
     facade.GetLoginRepo().Add(null);
 }
Ejemplo n.º 6
0
 public void Login_update_throws_exception_on_login_equals_null_test()
 {
     Facade facade = new Facade();
     facade.GetLoginRepo().Update(null);
 }
Ejemplo n.º 7
0
 public void Login_update_returns_false_on_login_not_exsisting_test()
 {
     Facade facade = new Facade();
     Assert.IsFalse(facade.GetLoginRepo().Update(new Login() { Username = "******" }));
 }
Ejemplo n.º 8
0
 public void Login_remove_throws_exception_on_login_equals_null_test()
 {
     Facade facade = new Facade();
     facade.GetLoginRepo().Remove("hej");
 }
Ejemplo n.º 9
0
        public void Login_remove_removes_from_db_test()
        {
            Facade facade = new Facade();
            Customer cusOne = new Customer()
            {
                FirstName = "Jonas Olesen",
                Address = "Møbelvej 3",
                BirthDate = DateTime.Now.AddYears(-20),
                Email = "*****@*****.**",
                PhoneNumber = 22755692
            };
            cusOne = facade.GetCustomerRepo().Add(cusOne);

            Login login = new Login() { Customer = cusOne, Password = "******", Username = "******" + Id++ };
            login = facade.GetLoginRepo().Add(login);

            facade = new Facade();
            facade.GetLoginRepo().Remove(login.Username);

            facade = new Facade();
            Assert.IsNull(facade.GetLoginRepo().Get(login.Username));
        }