Exemplo n.º 1
0
        public void ChangePassword_Invalid_Old_Password()
        {
            //Arrange
            uut = new ManageProfileHandler(mockContext.Object);
            Participant participant = new Participant
            {
                Email         = "*****@*****.**",
                Age           = DateTime.Now.Date,
                English       = true,
                Gender        = true,
                IdParticipant = 0,
                Password      = "******",
            };

            string oldPassword = "******";

            //Act
            DbStatus    status         = uut.ChangePasswordParticipantDB(participant, oldPassword);
            Participant newParticipant = mockContext.Object.Participant.FirstOrDefault(part => part.IdParticipant == participant.IdParticipant);

            //Assert
            Assert.That(newParticipant.Password != participant.Password);
            Assert.That(status.success == false);
            Assert.That(status.errormessage == "The old password was incorrect. Please try again");
        }
Exemplo n.º 2
0
        public void DeleteAccount()
        {
            //Arrange
            uut = new ManageProfileHandler(mockContext.Object);

            //Act
            uut.DeleteAccountParticipantDB(0);

            //Assert
            Assert.That(mockContext.Object.Participant.Count() == 1);
        }
Exemplo n.º 3
0
        public void DeleteAccount()
        {
            //Arrange
            uut = new ManageProfileHandler(mockContext.Object);
            Researcher researcher = new Researcher
            {
                Email        = "*****@*****.**",
                FirstName    = "Test1",
                LastName     = "Testesen",
                Password     = "******",
                IdResearcher = 0,
            };

            //Act
            uut.DeleteAcoountResearcherDB(researcher);

            //Assert
            Assert.That(mockContext.Object.Researcher.Count() == 1);
        }
Exemplo n.º 4
0
        public void ChangeProfileResearcher_ChangeFirstname()
        {
            //Arrange
            uut = new ManageProfileHandler(mockContext.Object);
            Researcher researcher = new Researcher
            {
                Email        = "*****@*****.**",
                FirstName    = "changedName",
                LastName     = "Testesen",
                Password     = "******",
                IdResearcher = 0,
            };

            //Act
            uut.ChangeProfileResearcherDB(researcher);
            Researcher newResearcher = mockContext.Object.Researcher.FirstOrDefault(res => res.IdResearcher == researcher.IdResearcher);

            //Assert
            Assert.That(newResearcher.FirstName == researcher.FirstName);
        }
Exemplo n.º 5
0
        public void ChangeProfileParticipant_Change_Email()
        {
            //Arrange
            uut = new ManageProfileHandler(mockContext.Object);
            Participant participant = new Participant
            {
                Email         = "*****@*****.**",
                Age           = DateTime.Now.Date,
                English       = true,
                Gender        = true,
                IdParticipant = 0,
                Password      = "******",
            };

            //Act
            uut.ChangeProfileParticipantDB(participant);
            Participant newParticipant = mockContext.Object.Participant.FirstOrDefault(part => part.IdParticipant == participant.IdParticipant);

            //Assert
            Assert.That(newParticipant.Email == "*****@*****.**");
        }
Exemplo n.º 6
0
        public void ChangePasswordResearcher_ValidOldPassword()
        {
            //Arrange
            uut = new ManageProfileHandler(mockContext.Object);
            Researcher researcher = new Researcher
            {
                Email        = "*****@*****.**",
                FirstName    = "Test1",
                LastName     = "ChangedLastname",
                Password     = "******",
                IdResearcher = 0,
            };

            string oldPassword = "******";

            //Act
            DbStatus   status        = uut.ChangePasswordResearcherDB(researcher, oldPassword);
            Researcher newResearcher = mockContext.Object.Researcher.FirstOrDefault(res => res.IdResearcher == researcher.IdResearcher);

            //Assert
            Assert.That(newResearcher.Password == researcher.Password);
            Assert.That(status.success == true);
        }
Exemplo n.º 7
0
        public void ChangePasswordResearcher_InvalidOldPassword()
        {
            //Arrange
            uut = new ManageProfileHandler(mockContext.Object);
            Researcher researcher = new Researcher
            {
                Email        = "*****@*****.**",
                FirstName    = "Test1",
                LastName     = "ChangedLastname",
                Password     = "******",
                IdResearcher = 0,
            };

            string oldPassword = "******";

            //Act
            DbStatus   status        = uut.ChangePasswordResearcherDB(researcher, oldPassword);
            Researcher newResearcher = mockContext.Object.Researcher.FirstOrDefault(res => res.IdResearcher == researcher.IdResearcher);

            //Assert
            Assert.That(newResearcher.Password != researcher.Password);
            Assert.That(status.success == false);
            Assert.That(status.errormessage == "The old password was incorrect. Please try again");
        }