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); }
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); }
public void Login_get_customer_returns_null_on_wrong_username_test() { Facade facade = new Facade(); Assert.IsNull(facade.GetLoginRepo().GetCustomerByLoginUsername("fejl")); }
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); }
public void Login_add_throws_exception_on_login_equals_null_test() { Facade facade = new Facade(); facade.GetLoginRepo().Add(null); }
public void Login_update_throws_exception_on_login_equals_null_test() { Facade facade = new Facade(); facade.GetLoginRepo().Update(null); }
public void Login_update_returns_false_on_login_not_exsisting_test() { Facade facade = new Facade(); Assert.IsFalse(facade.GetLoginRepo().Update(new Login() { Username = "******" })); }
public void Login_remove_throws_exception_on_login_equals_null_test() { Facade facade = new Facade(); facade.GetLoginRepo().Remove("hej"); }
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)); }