public void TestInit()
 {
     surveydb           = Database.GetConnection();
     surveyDal          = new SurveyDAL();
     userDAL            = new UserDAL();
     questionDAL        = new QuestionDAL();
     user               = new users();
     user.User_name     = userName;
     user.User_password = password;
     HelperDAL.AddUser(user);
     survey      = new surveys();
     survey.Name = surveyName;
     //survey.users = user;
     survey.User_name   = userName;
     SurveyCode         = HelperDAL.GenerateRandomSurveyCode();
     survey.Survey_code = SurveyCode;
     HelperDAL.AddSurvey(survey);
     question = new questions();
     question.Question_name = questionName;
     question.Surveys_id    = survey.Id;
     question.Input_type_id = 2;
     this.questionDAL.AddQuestion(question);
     this.optionChoicesDAL                 = new OptionChoicesDAL();
     this.optionChoice                     = new option_choices();
     this.optionChoice.Question_id         = question.Id;
     this.optionChoice.Option_choices_name = OptionChoiceName;
 }
示例#2
0
 public void TestInit()
 {
     surveydb           = Database.GetConnection();
     surveyDal          = new SurveyDAL();
     userDAL            = new UserDAL();
     questionDAL        = new QuestionDAL();
     user               = new users();
     user.User_name     = userName;
     user.User_password = password;
     HelperDAL.AddUser(user);
     survey      = new surveys();
     survey.Name = surveyName;
     //survey.users = user;
     survey.User_name   = userName;
     SurveyCode         = HelperDAL.GenerateRandomSurveyCode();
     survey.Survey_code = SurveyCode;
     HelperDAL.AddSurvey(survey);
     question = new questions();
     question.Question_name = questionName;
     question.Surveys_id    = survey.Id;
     question.Input_type_id = 1;
     this.questionDAL.AddQuestion(question);
     this.textAnswerDAL          = new TextAnswerDAL();
     this.textAnswer             = new text_answers();
     this.textAnswer.User_name   = userName;
     this.textAnswer.Question_id = question.Id;
     this.textAnswer.Answer      = TextAnswerText;
 }
 public void TestCleanUp()
 {
     HelperDAL.DeleteOptionChoice(optionChoice);
     HelperDAL.DeleteQuestion(question);
     HelperDAL.DeleteSurvey(survey);
     HelperDAL.DeleteUser(userName);
 }
示例#4
0
      public void GetTextAnswersFromDataBase()
      {
          HelperDAL.AddTextAnswersToDataBase(textAnswer);
          List <text_answers> text_Answers = this.textAnswerDAL.GetTextAnswers(question);

          HelperDAL.DeleteTextAnswersFromDataBase(question);
          Assert.AreNotEqual(text_Answers, null, "Cannot get text answers from Database.");
      }
      public void DeleteUserNameFromDataBase()
      {
          HelperDAL.AddUser(this.user);
          this.userDAL.DeleteUserByName(userName);
          users user2 = this.userDAL.GetUserByName(userName);

          Assert.That(user2, Is.Null, "User ins't deleted.");
      }
      public void GetOptionChoicesFromDataBaseShouldBeSuccessful()
      {
          HelperDAL.AddOptionChoicesToDataBase(optionChoice);
          List <option_choices> optionChoices = this.optionChoicesDAL.GetOptionsChoices(question);

          HelperDAL.DeleteOptionChoicesFromDataBase(question);
          Assert.AreNotEqual(optionChoices, null, "Cannot get option choices from Database.");
      }
示例#7
0
        public void DataBaseShouldReturnQuestionsBySurveyId()
        {
            HelperDAL.AddQuestionsToDataBase(question);
            List <questions> questions = this.questionDAL.GetQuestionsBySurveyId(this.survey.Id);

            HelperDAL.DeleteQuestionsBySurveyId(this.survey.Id);
            Assert.AreNotEqual(questions, null);
        }
      public void DataBaseShouldReturnAnswersByOptionChoiceId()
      {
          HelperDAL.AddAnswersToDataBase(answer);
          List <answers> answers = answersDAL.GetAnswers(optionChoice.Id);

          HelperDAL.DeleteAnswersFromDataBase(optionChoice.Id);
          Assert.AreNotSame(answers, null, "Cannot get answers from DataBase.");
      }
      public void UserNameShouldBeDifferent()
      {
          this.userDAL.AddUser(this.user);
          this.userDAL.UpdateUser(this.user, newPassword);
          string changedPassword = this.user.User_password;

          HelperDAL.DeleteUser(userName);
          Assert.That(newPassword, Is.EqualTo(changedPassword), "Password doesn't change");
      }
示例#10
0
      public void AddingUserToDataBase()
      {
          int count = HelperDAL.GetNumberOfUsers();

          this.userDAL.AddUser(this.user);
          int result = HelperDAL.GetNumberOfUsers();

          HelperDAL.DeleteUser(userName);
          Assert.AreNotSame(result, count, "Method isn't adding user to DataBase.");
      }
示例#11
0
      public void ShouldReturnSirveyByCode()
      {
          this.surveyDal.AddSurvey(survey);
          surveys surveyFromDataBase = this.surveyDal.GetSurveyBySurveyCode(SurveyCode);

          this.surveyDal.DeleteSurvey(survey);
          HelperDAL.DeleteUser(userName);
          Assert.IsNotNull(surveyFromDataBase);
          Assert.That(survey, Is.EqualTo(surveyFromDataBase));
      }
示例#12
0
      public void DatabaseShouldReturnSurveysByUserName()
      {
          HelperDAL.AddTestSurveysToDataBase(survey);
          int            surveysCount = this.surveydb.surveys.Count(x => x.User_name == userName);
          List <surveys> surveys      = this.surveyDal.GetAllSurveysByUserName(userName);
          int            secondCount  = surveys.Count();

          HelperDAL.DeleteSurveysFromDataBase(userName);
          this.userDAL.DeleteUserByName(userName);
          Assert.IsNotNull(surveys);
          Assert.That(surveysCount, Is.EqualTo(secondCount));
      }
示例#13
0
      public void SurveyNameShouldBeDifferent()
      {
          this.surveyDal.AddSurvey(survey);
          string newSurveyName = "NewName";

          this.surveyDal.UpdateSurvey(survey, newSurveyName);
          surveys survey2 = this.surveyDal.GetSurveyBySurveyCode(SurveyCode);

          this.surveyDal.DeleteSurvey(survey);
          HelperDAL.DeleteUser(userName);
          Assert.AreSame(newSurveyName, survey2.Name);
      }
        public EvaluacionEntity MapearEntity(SqlDataReader reader)
        {
            EvaluacionEntity objEvaluacionEntity = new EvaluacionEntity();

            objEvaluacionEntity.intIdEvaluacion      = HelperDAL.Int32(reader["intIdEvaluacion"]);
            objEvaluacionEntity.intIdPersona         = HelperDAL.Int32(reader["intIdPersona"]);
            objEvaluacionEntity.strCorreoElectronico = HelperDAL.String(reader["strCorreoElectronico"]);
            objEvaluacionEntity.strNombreCompleto    = HelperDAL.String(reader["strNombreCompleto"]);
            objEvaluacionEntity.intCalificacion      = HelperDAL.Int32(reader["intCalificacion"]);
            objEvaluacionEntity.dtFechaCreacion      = HelperDAL.DateTime(reader["dtFechaCreacion"]);
            objEvaluacionEntity.chEstado             = HelperDAL.Char(reader["chEstado"]);

            return(objEvaluacionEntity);
        }
示例#15
0
 public void TestInit()
 {
     surveydb           = Database.GetConnection();
     surveyDal          = new SurveyDAL();
     userDAL            = new UserDAL();
     user               = new users();
     user.User_name     = userName;
     user.User_password = password;
     survey             = new surveys();
     survey.Name        = surveyName;
     survey.users       = user;
     SurveyCode         = HelperDAL.GenerateRandomSurveyCode();
     survey.Survey_code = SurveyCode;
 }
示例#16
0
 public void TestCleanUp()
 {
     HelperDAL.DeleteSurvey(survey);
     HelperDAL.DeleteUser(userName);
 }