Exemple #1
0
        //метод для обработчика события CreatingSticker
        public Stick СreatingStickerForHander(AnswerId answerId)
        {
            Stick stick = new Stick(answerId.id, User.id);

            User.sticks.Add(stick);
            return(stick);
        }
Exemple #2
0
 public Score(ScoreId id, ProctorId proctorId, Grade grade, QuestionId questionId, AnswerId answerId) : base(id)
 {
     ProctorId  = proctorId;
     Grade      = grade;
     QuestionId = questionId;
     AnswerId   = answerId;
 }
        private void ProcessCreateStickResult(AnswerId answer)
        {
            var stick = new StickViewModel();

            stick.FromStick(Client.Listener.СreatingStickerForHander(answer));
            StickCollection.Add(stick);
        }
Exemple #4
0
        public AnswerTestBuilder WithId(long id)
        {
            var answerId = new AnswerId(id);

            Id = answerId;
            return(this);
        }
Exemple #5
0
 public AnswerTestBuilder()
 {
     Id        = new AnswerId(2);
     Body      = "Some Answer Text";
     Responder = 6;
     Question  = 83;
 }
Exemple #6
0
        public void TestAnswerIdQuestionIdAndLineNumberConstructor()
        {
            var answerId = new AnswerId(new QuestionId(new QuestionCatalogName("question-catalog"), 10), 12);

            Assert.That(answerId.Value, Is.EqualTo("question-catalog:10/12"));
            Assert.AreEqual(new QuestionId(answerId.Value.Split('/')[0]), answerId.QuestionId);
            Assert.AreEqual(int.Parse(answerId.Value.Split('/')[1]), answerId.LineNumber);
        }
 public ReceiveScoreCommand(Guid examId, Guid proctorId, double gradePercent,
                            QuestionId questionId, AnswerId answerId) : base(ExamId.With(examId))
 {
     ProctorId    = ProctorId.With(proctorId);
     GradePercent = gradePercent;
     QuestionId   = questionId;
     AnswerId     = answerId;
 }
Exemple #8
0
        public void Handle(AddAnswer command)
        {
            var id          = _answerRepository.GetNextId(AnswerSequenceName);
            var answerId    = new AnswerId(id);
            var responderId = _claimHelper.GetUserId();
            var answer      = new Answer(answerId, command.Body, command.Question, responderId);

            _answerRepository.Create(answer);
        }
Exemple #9
0
 //метод для обработчика события SigningUp, true - если зарегистрировались
 public bool SignUpForHandler(AnswerId answerId, string login, string password)
 {
     if (answerId.id == -1)
     {
         return(false);
     }
     User = new User(answerId.id, login);
     return(true);
 }
Exemple #10
0
        public void Handle(ChosenAnswer command)
        {
            var answerId        = new AnswerId(command.AnswerId);
            var answer          = _answerRepository.Get(answerId);
            var questionId      = new QuestionId(command.QuestionId);
            var questionAnswers = _answerRepository.GetByQuestionId(questionId);
            var userId          = _claimHelper.GetUserId();

            answer.SetAsChosenAnswer(command.QuestionInquirerId, userId, questionAnswers);
            _answerRepository.Update(answer);
        }
 private void ProcessSingUpResult(AnswerId id)
 {
     //TO DO:
     ////if (Client.Listener.SignUpForHandler(id, *Login* , *Password* ))
     //{
     //    MessageBox.Show("SingUp successful");
     //}
     //else
     //{
     //    MessageBox.Show("Failed to SingUp");
     //}
 }
Exemple #12
0
 public void TestAnswerIdInvalidFormat(string input, bool throws)
 {
     if (throws)
     {
         var ex = Assert.Throws <ArgumentException>(() => new AnswerId(input));
         Assert.AreEqual($"The AnswerId has an invalid format: \"{input}\", Expected \"<question-catalog-name>:<questionLineNumber>/<answerLineNumber>\".", ex.Message);
     }
     else
     {
         var answerId = new AnswerId(input);
         Assert.AreEqual(input, answerId.Value);
         var split = input.Split('/');
         Assert.AreEqual(split[0], answerId.QuestionId.Value);
     }
 }
Exemple #13
0
 public void TestEmptyAnswerIdThrows(string input)
 {
     Assert.Throws <ArgumentNullException>(() => AnswerId.From(input));
 }
Exemple #14
0
 public override int GetHashCode()
 {
     return(AnswerId.GetHashCode());
 }