public void Check_If_SqlUserRepository_Returns_Role_Rights_Against_A_Valid_Db_User() { // Arrange IWebUserRepository _Repository = new SqlWebUserRepository(); //Act var userInfo = _Repository.GetUserInfo(TestConstants.DbStudentUserId); //Assert Assert.IsNotNull(userInfo.VisibleReports); }
public void Check_WebUser_information_Is_Successfully_get_From_SQL_Repository_For_A_Valid_Db_Student() { // Arrange IWebUserRepository _Repository = new SqlWebUserRepository(); //Act var userInfo = _Repository.GetUserInfo(DbStudentNo); //Assert Assert.IsNotNull(userInfo); }
public void Check_If_SqlUserRepository_Returns_Correct_Role_Against_A_Valid_Db_User() { // Arrange IWebUserRepository _Repository = new SqlWebUserRepository(); //Act var studentUserInfo = _Repository.GetUserInfo(TestConstants.DbStudentUserId); var adminUserInfo = _Repository.GetUserInfo(TestConstants.DbAdminUserId); //Assert Assert.AreEqual("Student", studentUserInfo.Role); Assert.AreEqual("Admin", adminUserInfo.Role); }
public void Check_If_WebUserService_Returns_Role_Rights_Against_SqlWebUserRepository() { // Arrange IWebUserRepository userRepository = new SqlWebUserRepository(); var testLogService = new TestLogService(); IWebUserService _Repository = new WebUserService(userRepository, testLogService); //Act var studentUserInfo = _Repository.GetUserInfo(TestConstants.DbStudentUserId); var adminUserInfo = _Repository.GetUserInfo(TestConstants.DbAdminUserId); //Assert Assert.AreEqual("Student", studentUserInfo.Role); Assert.AreEqual("Admin", adminUserInfo.Role); }
public void Check_If_Student_is_Registered_Successfully_via_SqlWebUserRepository() { var webUserInfo = new WebUser(); webUserInfo.StudentId = "TEMP 1"; webUserInfo.AccountStatus = "InActive"; webUserInfo.SecretAnswer = "I am student."; webUserInfo.SecretQuestion = "Who am I?"; webUserInfo.Email = "*****@*****.**"; webUserInfo.WebUserId = Convert.ToInt32(Int32.MaxValue - 1); webUserInfo.UserName = "******"; webUserInfo.WebPassword = "******"; IWebUserRepository webUserService = new SqlWebUserRepository(); bool isRegistered = webUserService.Register(webUserInfo); Assert.IsTrue(isRegistered); }
public void Check_student_Register_successfully_or_Not_In_Repository() { var webUserInfo = new WebUser(); webUserInfo.AccountStatus = "InActive"; webUserInfo.SecretAnswer = "I am student."; webUserInfo.SecretQuestion = "Who am I?"; webUserInfo.Email = "*****@*****.**"; webUserInfo.WebUserId = Convert.ToInt32(Int32.MaxValue - 1); webUserInfo.UserName = "******"; webUserInfo.WebPassword = "******"; IWebUserRepository webUserService = new SqlWebUserRepository(); webUserService.Register(webUserInfo); // MA: User created by this test should be deleted from database manually. // Such tests should be avoided. or data should be deleted as well after its execution. }
public void Change_Password_Successfully_In_SQL_Repository_For_A_Valid_Db_Student() { // Get old Password IWebUserService webUserService = new WebUserService(); WebUser userInfo = webUserService.GetUserInfo(DbStudentNo); // Arrange IWebUserRepository _Repository = new SqlWebUserRepository(); _Repository.UpdatePassword(DbStudentNo, "Test"); // Get new password WebUser userInfoNew = webUserService.GetUserInfo(DbStudentNo); //Assert Assert.AreNotSame(userInfoNew.WebPassword, userInfo.WebPassword); // Revert _Repository.UpdatePassword(DbStudentNo, userInfo.WebPassword); }
public void Change_Secret_Question_Answer_Successfully_In_SQL_Repository_For_A_Valid_Db_Student() { // Get old Password IWebUserService webUserService = new WebUserService(); WebUser userInfo = webUserService.GetUserInfo(DbStudentNo); // Arrange IWebUserRepository _Repository = new SqlWebUserRepository(); _Repository.UpdateSecretQuestionAnswer(DbStudentNo, "what your name?", "Test"); // Get new password WebUser userInfoNew = webUserService.GetUserInfo(DbStudentNo); //Assert Assert.AreNotSame(userInfoNew.SecretQuestion, userInfo.SecretQuestion); Assert.AreNotSame(userInfoNew.SecretAnswer, userInfo.SecretAnswer); // Revert _Repository.UpdateSecretQuestionAnswer(DbStudentNo, userInfo.SecretQuestion, userInfo.SecretAnswer); }