Exemple #1
0
 public QuizState(QuizStatus status, int usedAttemptsCount, int score, int maxScore)
 {
     Status            = status;
     UsedAttemptsCount = usedAttemptsCount;
     Score             = score;
     MaxScore          = maxScore;
 }
Exemple #2
0
		private new void Configure()
		{
			base.Configure();
			submitButton = UlearnDriver.FindElementSafely(driver, ElementsClasses.QuizSubmitButton);
			submitAgainButton = UlearnDriver.FindElementSafely(driver, By.XPath(XPaths.QuizSubmitAgainButtonXPath));
			submitAgainStatus = UlearnDriver.FindElementSafely(driver, By.XPath(XPaths.QuizSubmitAgainStatusXPath));
			quizStatus = GetQuizStatus();
		}
Exemple #3
0
 private new void Configure()
 {
     base.Configure();
     submitButton      = UlearnDriver.FindElementSafely(driver, ElementsClasses.QuizSubmitButton);
     submitAgainButton = UlearnDriver.FindElementSafely(driver, By.XPath(XPaths.QuizSubmitAgainButtonXPath));
     submitAgainStatus = UlearnDriver.FindElementSafely(driver, By.XPath(XPaths.QuizSubmitAgainStatusXPath));
     quizStatus        = GetQuizStatus();
 }
Exemple #4
0
		public ChoiseBlock(List<QuizItem> quizItems, bool isMultiply, IWebElement statusElement, QuizStatus quizStatus)
		{
			this.quizItems = quizItems;
			this.isMultiply = isMultiply;
			blockStatus = quizItems.Any(x => x.GetStatus() == Status.Wrong) ? Status.Wrong :
				quizItems.Any(x => x.GetStatus() == Status.Right) ? Status.Right : Status.Undefined;
			var localStatus = UlearnDriver.HasCss(statusElement, "glyphicon-ok") ? Status.Right :
				UlearnDriver.HasCss(statusElement, "glyphicon-remove") ? Status.Wrong :
					Status.Undefined;
			if (localStatus != blockStatus)
				throw new Exception("Не верно произведена оценка квиза");
			if (quizStatus == QuizStatus.NoAttempts && localStatus == Status.Undefined)
				throw new Exception("Не произведена проверка квиза");
			if (quizStatus == QuizStatus.HasAttempts && quizItems.Any(x => x.GetStatus() == Status.Wrong || x.GetStatus() == Status.Right))
				throw new Exception("Отмечены верные/неверные варианты ответа при имеющихся попытках");
			if (quizStatus == QuizStatus.Clean && (quizItems.Any(x => x.GetStatus() == Status.Wrong || x.GetStatus() == Status.Right)) || (localStatus != Status.Undefined))
				throw new Exception("Отмечены верные/неверные варианты ответа или выставлены оценки квиз-блокам, когда квиз еще не решался");
		}
Exemple #5
0
        /// <summary> Insert a user status into the UserQuizStatus table </summary>
        private static void InsertQuizStatus(int userID, int moduleID, QuizStatus quizStatus)
        {
            string sqlInsertQuiz = @"
									if (SELECT TOP 1 QuizStatusID FROM tblUserQuizStatus WHERE UserID = @UserID AND ModuleID = @ModuleID ORDER BY UserQuizStatusID DESC) <> 5
									BEGIN
										INSERT into tblUserQuizStatus (UserID, ModuleID, QuizStatusID)
										VALUES(@UserID, @ModuleID, @QuizStatusID)
									END
									"                                    ;

            System.Data.SqlClient.SqlParameter[] sqlParams =
            {
                new SqlParameter("@userID",       userID),
                new SqlParameter("@ModuleID",     moduleID),
                new SqlParameter("@quizStatusID", (int)Enum.Parse(typeof(QuizStatus), quizStatus.ToString()))
            };

            string connectionString = ConfigurationSettings.AppSettings["ConnectionString"] + "password="******"password"] + ";";

            Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(connectionString, System.Data.CommandType.Text, sqlInsertQuiz, sqlParams);
        }
Exemple #6
0
 public Student(string firstName, string lastName, string userName, string password) :
     base(firstName, lastName, userName, password, RoleEnum.Student)
 {
     QuizScore  = 0;
     QuizStatus = QuizStatus.NotStarted;
 }
Exemple #7
0
 public bool CanUserFillQuiz(QuizStatus status)
 {
     return(status == QuizStatus.ReadyToSend || status == QuizStatus.WaitsForManualChecking);
 }
Exemple #8
0
        public ChoiseBlock(List <QuizItem> quizItems, bool isMultiply, IWebElement statusElement, QuizStatus quizStatus)
        {
            this.quizItems  = quizItems;
            this.isMultiply = isMultiply;
            blockStatus     = quizItems.Any(x => x.GetStatus() == Status.Wrong) ? Status.Wrong :
                              quizItems.Any(x => x.GetStatus() == Status.Right) ? Status.Right : Status.Undefined;
            var localStatus = UlearnDriver.HasCss(statusElement, "glyphicon-ok") ? Status.Right :
                              UlearnDriver.HasCss(statusElement, "glyphicon-remove") ? Status.Wrong :
                              Status.Undefined;

            if (localStatus != blockStatus)
            {
                throw new Exception("Не верно произведена оценка квиза");
            }
            if (quizStatus == QuizStatus.NoAttempts && localStatus == Status.Undefined)
            {
                throw new Exception("Не произведена проверка квиза");
            }
            if (quizStatus == QuizStatus.HasAttempts && quizItems.Any(x => x.GetStatus() == Status.Wrong || x.GetStatus() == Status.Right))
            {
                throw new Exception("Отмечены верные/неверные варианты ответа при имеющихся попытках");
            }
            if (quizStatus == QuizStatus.Clean && (quizItems.Any(x => x.GetStatus() == Status.Wrong || x.GetStatus() == Status.Right)) || (localStatus != Status.Undefined))
            {
                throw new Exception("Отмечены верные/неверные варианты ответа или выставлены оценки квиз-блокам, когда квиз еще не решался");
            }
        }