public IQuestionType GetQuestion(QuestionTypeEnum type) { IQuestionType qType = null; switch (type) { case QuestionTypeEnum.BuiltIn: break; case QuestionTypeEnum.QandA: qType = _svcContainer.QAQuestionSvc; break; case QuestionTypeEnum.MultipleChoice: qType = _svcContainer.MCQuestionSvc; break; case QuestionTypeEnum.MultiChoiceSame: qType = _svcContainer.MultiChoiceSameQuestionSvc; break; default: break; } return(qType); }
public void WhenGivenValidQuestion_NameTextAndTypeCorrect( string validText, string expectedId, string expectedText, IQuestionType expectedType) { CreateForm(validText); var question = m_domainItemLocator .GetAll <IQuestionNode>() .FirstOrDefault(); Assert.IsNotNull(question, "could not find a question node"); Assert.AreEqual( expected: expectedId, actual: question.QuestionName, message: "The question name did not match"); Assert.AreEqual( expected: expectedText, actual: question.QuestionText, message: "The question text did not match"); Assert.IsTrue( expectedType.GetType() == question.QuestionType.GetType(), message: "The question type did not match"); }
public static TestCaseData TypeResult(string qlType, IQuestionType questionType) { var formTemplate = @"form TestForm {{ q: ""i"" {0}}}"; return(new TestCaseData( string.Format(formTemplate, qlType), questionType)); }
public Task<int> UpdateAsync(IQuestionType questionType) { if (String.IsNullOrEmpty(questionType.Id)) { throw new ArgumentNullException("Id"); } return questionTypeRepository.UpdateAsync(questionType); }
private Style GetStyleDefaultForType(IQuestionType questionType) { var styleStack = StyleStacks[questionType.GetType()]; return(styleStack.PeekStyle()); throw new ArgumentException(nameof(questionType), $"unknown"); }
//private Dictionary<QuestionTypeEnum, Func<int, bool, bool>> deleteQuestionMap; //private void InitializeDeleteQuestionMap() //{ // deleteQuestionMap = new Dictionary<QuestionTypeEnum, Func<int, bool, bool>>() // { // {QuestionTypeEnum.QandA, DeleteQandAQuestion}, // {QuestionTypeEnum.MultipleChoice, DeleteMultipleChoiceQuestion} // }; //} public bool DeleteQuestion(QuestionTypeEnum type, int id, bool callSaveChanges = true) { IQuestionType qType = _questionTypeFactory.GetQuestion(type); if (qType != null) { qType.DeleteQuestion(id, callSaveChanges); } return(false); }
//private bool DeleteQandAQuestion(int id, bool callSaveChanges = true) //{ // return _qaQuestionSvc.DeleteQuestion(id, callSaveChanges); //} //private bool DeleteMultipleChoiceQuestion(int id, bool callSaveChanges = true) //{ // return _mcQuestionSvc.DeleteQuestion(id, callSaveChanges); //} #endregion #region CreateQuestion public QuestionModel CreateQuestion(QuestionTypeEnum type, object model) { IQuestionType qType = _questionTypeFactory.GetQuestion(type); if (qType != null) { return(qType.CreateQuestion(model)); } return(null); }
public UserInputQuestionNode( Guid id, string definition, string questionId, string questionText, IQuestionType questionType) : base(id, definition) { QuestionName = questionId; QuestionText = questionText; QuestionType = questionType; }
public SimpleQuestion(QuestionSet questionSet) { InitializeComponent(); QuestionSet = questionSet; QuestionLabel.Text = QuestionSet.QuestionText; QuestionTypes.QuestionPanel = QuestionPanel; QuestType = QuestionTypes.GetQuestionType(QuestionSet); var question = QuestType.getUserControl(); QuestionTypes.SetQuest(question, QuestionSet); QuestionPanel.Controls.Add(question); }
public void GivenAValidType_ReturnsQuestionOfCorrectType( string validDefinition, IQuestionType questionType) { CreateOutputForm(validDefinition); var domainItem = m_domainItemLocator .GetAll <IQuestionOutputItem>() .FirstOrDefault(); Assert.NotNull(domainItem); Assert.AreEqual( expected: questionType.GetType(), actual: domainItem.QuestionType.GetType()); }
public CalculatedQuestionNode( Guid id, string definition, string questionId, string questionText, IQuestionType questionType, DomainId <ICalculationNode> calculation) : base(id, definition) { QuestionName = questionId; QuestionText = questionText; QuestionType = questionType; CalculatedValue = calculation; }
public QuestionModel( Guid questionOutputId, Guid questionVariableId, string questionText, bool visible, bool readOnly, IQuestionType questionType) { QuestionVariableId = questionVariableId; QuestionOutputId = questionOutputId; QuestionText = questionText; Visible = visible; ReadOnly = readOnly; QuestionType = questionType; }
public DomainId <ICalculatedQuestionNode> CreateCalculatedQuestion( string definition, string questionName, string questionText, IQuestionType questionType, DomainId <ICalculationNode> calculation) { var question = new CalculatedQuestionNode( m_ids.Next, definition, questionName, questionText, questionType, calculation); return(DomainItemRegistration <ICalculatedQuestionNode>(question)); }
public DomainId <IUserInputQuestionNode> CreateUserInputQuestion( string definition, string questionName, string questionText, IQuestionType questionType) { var question = new UserInputQuestionNode( m_ids.Next, definition, questionName, questionText, questionType); questionType.InitializeVariable(m_symbolTable, question.Id); return(DomainItemRegistration <IUserInputQuestionNode>(question)); }
public QuestionOutputItem( Guid id, DomainId <IQuestionNode> variable, string questionName, string questionText, IQuestionType questionType, string value, bool isVisible, bool isReadonly) { Id = id; Variable = variable; QuestionName = questionName; DisplayName = questionText; QuestionText = questionText; Value = value; QuestionType = questionType; Visible = isVisible; ReadOnly = isReadonly; }
private void QuestionListBox_SelectedValueChanged(object sender, EventArgs e) { foreach (var ctrl in Controls.OfType <UserControl>().ToList()) { Controls.Remove(ctrl); } if (QuestionListBox.SelectedIndex != -1) { using (ForumContainer container = new ForumContainer()) { var selectedValue = Convert.ToInt32(QuestionListBox.SelectedValue.ToString()); QuestionSet = container.QuestionSet.FirstOrDefault(x => x.QuestionId == selectedValue); QuestionLabel.Text = QuestionSet.QuestionText; QuestType = QuestionTypes.GetQuestionType(QuestionSet); var question = QuestType.getUserControl(); QuestionTypes.SetQuest(question, QuestionSet, false); Controls.Add(question); } } }
public async Task<int> UpdateAsync(IQuestionType questionType) { return await repository.UpdateEntityAsync<QuestionTypeEntity>(Mapper.Map<QuestionTypeEntity>(questionType)); }
public Task<int> InsertAsync(IQuestionType questionType) { questionType.Id = Guid.NewGuid().ToString(); return questionTypeRepository.InsertAsync(questionType); }
public async Task<int> InsertAsync(IQuestionType questionType) { return await repository.InsertEntityAsync<QuestionTypeEntity>(Mapper.Map<QuestionTypeEntity>(questionType)); }
public DefaultStyle(IQuestionType type, DomainId <IStyleNode> style) { Type = type; Style = style; }