// END - Update All Surveys | Attitudes // START - Update Selected Survey | Attitude private void UpdateSelectedSurvey(long SurveyID, ListView listView) { using (SurveyController surveyController = new SurveyController()) { Survey selectedSurvey = surveyController.Get(SurveyID); if (LoggedUser.IsAdministrator()) { txt_EditSurveyDetailsName.Text = selectedSurvey.SurveyName; txt_EditSurveyDetailsName.Tag = selectedSurvey.SurveyID.ToString(); SelectedSurveyOriginalName = selectedSurvey.SurveyName; IsSelectedSurveyOriginalNameChanged = false; } else { txt_ViewSurveyDetailsName.Text = selectedSurvey.SurveyName; txt_ViewSurveyDetailsName.Tag = selectedSurvey.SurveyID.ToString(); } } listView.Clear(); using (QuestionController questionController = new QuestionController()) { List <Question> Questions = questionController.GetQuestionsForSurvey(SurveyID); foreach (Question question in Questions) { listView.Items.Add(new ListViewItem(question.Question1) { Tag = question.QuestionID }); } } }
private void UpdateSelectedAttitude(long AttitudeID, ListView listView) { using (AttitudeController attitudeController = new AttitudeController()) { Attitude selectedAttitude = attitudeController.GetAttitude(AttitudeID); if (LoggedUser.IsAdministrator()) { txt_EditAttitudeDetailsName.Text = selectedAttitude.AttitudeName; txt_EditAttitudeDetailsName.Tag = selectedAttitude.AttitudeID.ToString(); SelectedAttitudeOriginalName = selectedAttitude.AttitudeName; IsSelectedAttitudeOriginalNameChanged = false; } } listView.Clear(); using (QuestionController questionController = new QuestionController()) { List <Question> Questions = questionController.GetQuestionsForAttitude(AttitudeID); foreach (Question question in Questions) { listView.Items.Add(new ListViewItem(question.Question1) { Tag = question.QuestionID }); } } }
public void GetQuestionIdChar() { var controller = new QuestionController(); IHttpActionResult actionResult = controller.Getquestion('x'); Assert.IsInstanceOfType(actionResult, typeof(NotFoundResult)); }
private void toolStripMenuItem_AddNewQuestion_Click(object sender, EventArgs e) { MaterialMessageInput.MessageBoxResultInput result = MaterialMessageInput.MessageBoxResultInput.None; long SurveyID = Convert.ToInt64(txt_EditSurveyDetailsName.Tag); if (SurveyID != -1) { result = MaterialMessageInput.Show("Noua intrebare care sa fie adaugata in chestionar:", "Easy Survey - Add New Question", MaterialMessageInput.MessageBoxButtonsInput.OKCancel, addQuestion: true); } if (result == MaterialMessageInput.MessageBoxResultInput.OK) { using (QuestionController questionController = new QuestionController()) { string QuestionName = MaterialMessageInput.Answer; // long SurveyID = Convert.ToInt64(txt_EditSurveyDetailsName.Tag); Question newQuestion = new Question { Question1 = QuestionName }; questionController.Add(ref newQuestion, SurveyID); ListViewItem newQuestionItem = new ListViewItem() { Tag = newQuestion.QuestionID.ToString(), Text = newQuestion.Question1 }; listView_EditSurveyQuestions.Items.Add(newQuestionItem); int QuestionIndex = listView_EditSurveyQuestions.Items.Count - 1; listView_EditSurveyQuestions.Items[QuestionIndex].Selected = true; listView_EditSurveyQuestions.Items[QuestionIndex].Focused = true; listView_EditSurveyQuestions.Items[QuestionIndex].EnsureVisible(); } } }
public void PutquestionChoice() { QuestionController controller = new QuestionController(); IHttpActionResult actionResult = controller.Putquestion(10000, null); Assert.IsInstanceOfType(actionResult, typeof(NotFoundResult)); }
public void QuestionsController_GetDetailed_Should_Render_Default_View_With_Correct_Model() { //Arrange ApplicationUser user = new ApplicationUser() { Id = "0", UserName = "******" }; List <Option> options = new List <Option>() { new Option() { Id = 1, Description = "test", OwnerId = "0", Owner = user } }; Question question = new Question() { Id = 0, Title = "test", OwnerId = "0", Owner = user }; var mockedService = new Mock <IQuestionService>(); mockedService.Setup(s => s.GetById(It.IsAny <int>())).Returns(question); MapperHelper helper = new MapperHelper(); QuestionController controller = new QuestionController(mockedService.Object, helper); //Act & Assert controller.WithCallTo(c => c.GetDetailed(0)).ShouldRenderDefaultView().WithModel <QuestionViewModel>(); }
public virtual void Setup() { Transform win = transform.Find("Screen").Find("UI").Find("Canvas").Find("Windows"); Numpad = win.parent.Find("Screen").GetComponentInChildren <NumpadController>(); Sound = GetComponent <ComputerSounds>(); Sound.Setup(this); Login = win.GetComponent <LoginController>(); Login.Setup(this); Desktop = win.GetComponent <DesktopController>(); Desktop.Setup(); SS = win.GetComponent <StudentStress>(); SS.Setup(); Windows = win.GetComponent <ComputerWindows>(); Windows.Setup(this); Calculator = win.GetComponent <CalculatorController>(); Calculator.Setup(); Question = win.GetComponent <QuestionController>(); Question.Setup(); Exam = win.GetComponent <ExamController>(); Text = win.GetComponent <TextController>(); Text.Setup(); Commands = new ComputerCommands(this); }
private void toolStripMenuItem_AddAttitudeDefinitions_Click(object sender, EventArgs e) { MaterialMessageComboBox.MessageBoxResult result = MaterialMessageComboBox.MessageBoxResult.None; long AttitudeID = Convert.ToInt64(txt_EditAttitudeDetailsName.Tag); if (AttitudeID != -1) { result = MaterialMessageComboBox.Show("Select survey and question.", "Easy Survey - Add New Attitude Definition", MaterialMessageComboBox.MessageBoxButtons.OKCancel, AttitudeID); } if (result == MaterialMessageComboBox.MessageBoxResult.OK) { //long NewSurveyID = MaterialMessageComboBox.Answer1; long NewQuestionID = MaterialMessageComboBox.Answer2; using (QuestionController questionController = new QuestionController()) using (AttitudeDefinitionController attitudeDefinitionController = new AttitudeDefinitionController()) { string QuestionName = questionController.Get(NewQuestionID).Question1; if (attitudeDefinitionController.AddRelation(AttitudeID, NewQuestionID)) { listView_EditAttitudeDefinition.Items.Add(new ListViewItem() { Text = QuestionName, Tag = NewQuestionID }); } } } }
private void Awake() { if (instance == null) { instance = this; } }
public void LoadSuccessTest() { QuestionController question = new QuestionController(); int expectedAnswer = question.LoadSpriteTest("002"); Assert.AreEqual(1, expectedAnswer); }
public void SetUp() { _fixture = new Fixture().Customize(new AutoMoqCustomization()); _queryDispatcherMock = _fixture.Freeze <Mock <IQueryDispatcher> >(); _commandDispatcherMock = _fixture.Freeze <Mock <ICommandDispatcher> >(); _controller = new QuestionController(_queryDispatcherMock.Object, _commandDispatcherMock.Object, new QuestionViewModelConverter(), new QuestionDtoConverter()); }
public QuestionControllerTest() { var mappingConfig = new MapperConfiguration(mc => mc.AddProfile(new MappingProfile())); var mapper = mappingConfig.CreateMapper(); _controller = new QuestionController(new TestApplicationContext(), mapper); }
/// <summary> /// sinh chi tiết đề thi /// </summary> /// <param name="examformCode">mã đề thi</param> /// <param name="testStructCode"></param> /// <returns></returns> public int CreateExamFormDetail(ref List <EXAMFORMDETAIL_OBJ> liExamformdetail, EXAMFORM_OBJ objExamform, List <TESTSTRUCTDETAIL_OBJ> liTestStructDetail, ref string currentCode) { int ret = 0; Random rnd = new Random(); EXAMFORMDETAIL_BUS bus = new EXAMFORMDETAIL_BUS(); EXAMFORMDETAIL_OBJ obj = new EXAMFORMDETAIL_OBJ(); // List<EXAMFORMDETAIL_OBJ> liExamformdetail = new List<EXAMFORMDETAIL_OBJ>(); //Chuẩn bị các mã //string currentCode = bus.genNextCode(obj); foreach (var testStructDetail in liTestStructDetail) { int amountQues = testStructDetail.AMOUNT; // số câu hỏi // double toTalMark = testStructDetail.TOTALMARK; // tổng số điểm if (amountQues > 0) // nếu có câu hỏi trong cấu trúc đề thi { string subjectContentCode = testStructDetail.SUBJECTCONTENTCODE; string questionTypeCode = testStructDetail.QUESTIONTYPECODE; int countQues = 0; //tổng số câu hỏi đã lấy được // double countMark = 0; // tổng số điểm lấy được // get ListQuestionGroup by subjectContentCode and questiontypecode List <QUESTIONGROUP_OBJ> liQuesGroup = new QuestionController().GetQGroupBySbjContent(subjectContentCode, questionTypeCode); List <string> selectedQuesGroupCode = new List <string>(); // danh sách nhóm câu hỏi đã được chọn //Random ra câu hỏi, //random được câu nào thì remove câu đó khỏi danh sách ban đầu (ko bị random lại) while (liQuesGroup.Count > 0 && countQues < amountQues) { int r = rnd.Next(0, liQuesGroup.Count); QUESTIONGROUP_OBJ questionGroup = liQuesGroup[r]; selectedQuesGroupCode.Add(questionGroup.CODE); liQuesGroup.RemoveAt(r); countQues++; } // insert examformdetail //ret = InsertExamFormDetail(objExamform.CODE, selectedQuesGroupCode, testStructDetail.CODE); //Tính toán các bước để xác định các được sinh ra for (int i = 0; i < selectedQuesGroupCode.Count; i++) { obj = new EXAMFORMDETAIL_OBJ(); obj.EXAMFORMCODE = objExamform.CODE; obj.QUESTIONGROUPCODE = selectedQuesGroupCode[i]; obj.TESTSTRUCTDETAILCODE = testStructDetail.CODE; obj.THEORDER = i + 1; obj.CODE = currentCode; //Tính toán mã mới currentCode = bus.genNextCode(obj, currentCode); //Thêm vào danh sách chuẩn bị vào liExamformdetail.Add(obj); } } } //Insert here //ret = bus.InsertMultiItems(liExamformdetail); //bus.CloseConnection(); return(ret); }
public async void ChangeQuestion_ValidObjectPassed_ReturnsOk() { // Arrange var mock = new Mock <IQuestionService>(); mock.Setup(s => s.UpdateAsync(It.IsAny <int>(), It.IsAny <QuestionDTO>())).Returns((int id, QuestionDTO s) => FakeServicesMethods.ChangeQuestion(id, s)); var controller = new QuestionController(mock.Object); // Act var question = new QuestionDTO { Id = 1, Title = "Question 1", QuestionText = "text", Comment = "", Answers = new List <AnswerDTO>() }; var result = await controller.ChangeQuestion(1, question); var okResult = result as OkObjectResult; // Assert Assert.NotNull(okResult); Assert.Equal(200, okResult.StatusCode); }
// Start is called before the first frame update void Start() { _enemyScript = enemy.GetComponent <EnemyScript>(); _playerScript = player.GetComponent <PlayerScript>(); _questionController = GetComponent <QuestionController>(); _enemyAnimatorMap = GetComponent <EnemyAnimatorMap>(); _dataController = FindObjectOfType <DataController>(); //Gets player character and enemy character info int chrIdx = int.Parse(_dataController.currentUser.chr.Substring(12, 3)); string enemyName; if (_dataController.getCustom()) { enemyName = _dataController.GetCurrentRoundData(_dataController.getLvlID()).boss; } else { enemyName = _dataController.GetCurrentRoundData(_dataController.getCurrLevel()).boss; } //Displays player character according to the player's choice player.GetComponent <Animator>().runtimeAnimatorController = animatorList[chrIdx - 1]; //Displays the enemy character based on the level data enemy.GetComponent <Animator>().runtimeAnimatorController = _enemyAnimatorMap.GetAnimatorController(enemyName); playerHP = _playerScript.GetCurrentHp(); }
public void SetUp() { _mockUrlHelper = new Mock <IUrlHelper>(MockBehavior.Strict); _employerAccountServiceMock = new Mock <IEmployerAccountService>(MockBehavior.Strict); _reportService = new Mock <IReportService>(MockBehavior.Strict); _periodServiceMock = new Mock <IPeriodService>(MockBehavior.Strict); _periodServiceMock.Setup(s => s.GetCurrentPeriod()).Returns(Period.FromInstantInPeriod(DateTime.UtcNow)); _mockUserService = new Mock <IUserService>(MockBehavior.Strict); _controller = new QuestionController( _reportService.Object, _employerAccountServiceMock.Object, null, _periodServiceMock.Object, _mockUserService.Object) { Url = _mockUrlHelper.Object }; _employerIdentifier = new EmployerIdentifier() { AccountId = "ABCDE", EmployerName = "EmployerName" }; _employerAccountServiceMock.Setup(s => s.GetCurrentEmployerAccountId(It.IsAny <HttpContext>())).Returns(_employerIdentifier); _employerAccountServiceMock.Setup(s => s.GetCurrentEmployerAccountId(null)).Returns(_employerIdentifier); }
public QuizPageJustText(QuestionController questionController) { InitializeComponent();//Render View _questionController = questionController; _question = _questionController.TakeFirstQuestion(); PopulateView(); }
public void Send_question() { using (var loggerFactory = CreateLoggerFactory()) { var node = new Mock <INode>(); Question questionInNode = null; node.Setup(n => n.Add(It.IsAny <Question>())).Callback <Question>(v => questionInNode = v); var controller = new QuestionController(node.Object, loggerFactory.CreateLogger <QuestionController>()); var question = new Question { CommunityId = Guid.NewGuid(), Choices = new[] { new Choice { Text = "Opción Roja" }, new Choice { Text = "Opción Azul" } } }; var response = controller.Post(question); Assert.AreEqual((int)HttpStatusCode.Accepted, response.StatusCode); node.Verify(n => n.Add(It.IsAny <Question>()), Times.Once); Assert.IsNotNull(questionInNode); Assert.AreEqual(question.CommunityId, questionInNode.CommunityId); Assert.AreEqual(2, questionInNode.Choices.Length); Assert.AreEqual(question.Choices[0].Text, question.Choices[0].Text); Assert.AreEqual(question.Choices[1].Text, question.Choices[1].Text); } }
/// <summary> /// handles save click event. /// Prompts user for conformation and then saves and goes back to quizzes vies /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void saveToolStripMenuItem_Click(object sender, EventArgs e) { var result = MessageBox.Show("Are you sure you want to save changes to this quiz?", "Saving", MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { //if first time were saving this quiz, we need to add it to the course as well bool addToCourse = (GlobalData.currentQuiz.Id == 0); //save it first QuizController.SaveQuiz(GlobalData.currentQuiz); //now add it to course if we determined it was first save if (addToCourse) { CourseController.AddQuiz(GlobalData.currentCourse, GlobalData.currentQuiz); } //now delete all questions that are no longer part of this quiz foreach (QuestionData qDelete in questionsToDeleteOnSave) { QuestionController.DeleteQuestion(qDelete); } //return to quizzes view GoBackToQuizzesView(); } }
public FillInAQuestionarie() { InitializeComponent(); this.DataContext = this; doctorController = new DoctorController(); questionController = new QuestionController(); listDoctors = doctorController.GetAll(); List <ListaDoktoriIme> listDoctorsBinding = new List <ListaDoktoriIme>(); foreach (DoctorUser d in listDoctors) { StringBuilder l = new StringBuilder(); l.Append(d.firstName + " "); l.Append(d.secondName + " "); l.Append(d.id); ListaDoktoriIme a = new ListaDoktoriIme(); a.DoctorName = l.ToString(); listDoctorsBinding.Add(a); } doctorCombo.ItemsSource = listDoctorsBinding; QuestionList = questionController.GetAll(); }
public async void ChangeQuestion_ValidObjectPassed_ReturnedResponseHaUpdatedItem() { // Arrange var mock = new Mock <IQuestionService>(); mock.Setup(s => s.UpdateAsync(It.IsAny <int>(), It.IsAny <QuestionDTO>())).Returns((int id, QuestionDTO s) => FakeServicesMethods.ChangeQuestion(id, s)); var controller = new QuestionController(mock.Object); // Act var question = new QuestionDTO { Id = 1, Title = "Question 1", QuestionText = "text", Comment = "", Answers = new List <AnswerDTO>() }; var result = await controller.ChangeQuestion(1, question); var okResult = result as OkObjectResult; // Assert var item = Assert.IsAssignableFrom <QuestionDTO>(okResult.Value); Assert.Equal(1, (okResult.Value as QuestionDTO)?.Id); }
protected override void Given() { _container = new Container(); _container.Configure(TestHelper.ConfigureIoc()); MockUrlHelper = new Mock <IUrlHelper>(); MockUrlHelper.Setup(u => u.Action(It.IsAny <UrlActionContext>())).Returns("!"); QuestionController = _container.GetInstance <QuestionController>(); QuestionController.Url = MockUrlHelper.Object; SUT = _container.GetInstance <ReportController>(); SUT.Url = MockUrlHelper.Object; SUT.ObjectValidator = Mock.Of <IObjectModelValidator>(); var mockContext = new Mock <HttpContext>(); mockContext.Setup(c => c.User).Returns(new TestPrincipal()); SUT.ControllerContext.HttpContext = mockContext.Object; QuestionController.ControllerContext.HttpContext = mockContext.Object; TestHelper.ClearData(); SUT.PostCreate(); }
private void cmb_Answer1_SelectedIndexChanged(object sender, EventArgs e) { string SelectedSurveyName = cmb_Answer1.Text; Survey SelectedSurvey = Surveys.Where(item => item.SurveyName == SelectedSurveyName).First(); if (SelectedSurvey != null) { long SurveyID = SelectedSurvey.SurveyID; QuestionController questionController = new QuestionController(); QuestionsOfSurvey = questionController.GetQuestionsForSurvey(SurveyID); cmb_Answer2.Items.Clear(); foreach (Question question in QuestionsOfSurvey) { cmb_Answer2.Items.Add(question.Question1); } MaterialMessageComboBox.Answer1 = SurveyID; IsValidatedAnswer1 = true; IsValidatedAnswer2 = false; } else { SetStatus("Please choose from the existing Survey list."); cmb_Answer2.Items.Clear(); IsValidatedAnswer1 = false; } }
public void QuesionController_SaveQuestion_FirstSave() { QuestionController controller = new QuestionController(); ViewResult result = null; Assert.IsNotNull(result); }
public void SetUp() { _questionService = new Mock <IQuestionService>(); _questionTransformer = new Mock <IQuestionTransformer>(); _answersForNodeBuilder = new Mock <IAnswersForNodeBuilder>(); _cacheManager = new Mock <ICacheManager <string, string> >(); _sut = new QuestionController(_questionService.Object, _questionTransformer.Object, _answersForNodeBuilder.Object); }
private void BuildAndSubmitOnlyOutlineActionsMandatoryFactor() { QuestionController .Submit( new FactorsAnswersBuilder() .BuildValidOutlineActionsAnswer() .ForReportingPeriod(TestHelper.CurrentPeriod)); }
private void BalloonPop(String popValue) { print("ballon pop called..." + popValue); QuestionController controller = GameObject.Find("CustomizedBalloonPooler").GetComponent <QuestionController> (); controller.addState(popValue); }
public AddQuestion(UserModel user, SubjectModel subject, TestModel test) { this.user = user; this.subject = subject; this.test = test; this.questionController = new QuestionController(); InitializeComponent(); }
private void BuildAndSubmitOnlyYourEmployeesNumbers() { QuestionController .Submit( new ReportNumbersAnswersBuilder() .BuildValidYourEmployeesAnswers() .ForReportingPeriod(TestHelper.CurrentPeriod)); }
void Awake() { Question = GameController.getQuestion(); timer = GameController.getTimer(); main = this; GameObject.Find("Timer").GetComponent <Text> ().text = timer.ToString("F"); SpawnBalloons(); }
public override void Start() { base.Start(); CFG.ApplyFPSRate(); _humanoidController = this.GetComponent<HumanoidController>(); _playerController = this.GetComponent<PlayerController>(); _questionController = this.GetComponent<QuestionController>(); _humanoidController.enabled = false; _questionController.enabled = false; Setup(); }
public QuestionView(Object question) { // Create the controller controller = new QuestionController(question); // Handlers for external events controller.QuestionDomainsReceived += new QuestionController.ExternalEventHandler(OnQuestionDomainsReceived); controller.QuestionOwnerReceived += new QuestionController.ExternalEventHandler(OnQuestionOwnerReceived); controller.QuestionStatusChanged += new QuestionController.ExternalEventHandler(OnQuestionStatusChanged); controller.QuestionAnswersReceived += new QuestionController.ExternalEventHandler(OnQuestionAnswersReceived); controller.QuestionDomainsResourcesReceived += new QuestionController.ExternalEventHandler(OnQuestionDomainsResourcesReceived); controller.ThisUserStateChanged += new QuestionController.ExternalEventHandler(OnThisUserStateChanged); controller.QuestionResourcesReceived += new QuestionController.ExternalEventHandler(OnQuestionResourcesReceived); controller.UserVoteChecked += new QuestionController.ExternalEventHandler(OnUserVoteChecked); controller.UserRankUpdated += new QuestionController.ExternalEventHandler(OnUserRankUpdated); // Register the controller handlers to the service controller.RegisterHandlers(); // Initialize Component InitializeComponent(); // Set the parent and display the window SetMdiParent(); ShowForm(); // Handlers for internal events this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(OnFormClosing); //initialize //question status if (((QuestionData)question).Status == true) { QuestionTitleLabel.ForeColor = System.Drawing.Color.MediumBlue; stateButton.ForeColor = System.Drawing.Color.MediumBlue; stateButton.Text = "solved"; } else { QuestionTitleLabel.ForeColor = System.Drawing.Color.Green; stateButton.ForeColor = System.Drawing.Color.Green; stateButton.Text = "unsolved"; } //question content QuestionContentRichTextBox.SelectedRtf = ((QuestionData)question).Content; //question date DateAndTimeLabel.Text = ((QuestionData)question).Timestamp.ToString(); //question title QuestionTitleLabel.Text = ((QuestionData)question).Title; }
public Boolean DeleteFields(ParticipantField field) { var questions = (from item in session.Query<DemographicQuestion>() where item.linkedField!=null && item.linkedField.fieldID == field.fieldID select item).ToList(); QuestionController p = new QuestionController(); Poll poll; if (questions != null && questions.Count != 0) { poll = (from item in session.Query<Poll>() where item.questions.Contains(questions.First()) select item).FirstOrDefault(); foreach (DemographicQuestion q in questions) { p.ConvertToCustom(q.questionID, poll.pollID); if ((from item in session.Query<ParticipantField>() where item.fieldID==field.fieldID select item).Count()==0) return true; } } foreach (ParticipantFieldValue pv in field.fieldValues) { pv.participant = null; pv.groupd = null; } session.Delete(field); return true; }
// Use this for initialization void Start () { instance = this; Array hairsArray = Enum.GetValues (typeof(Condition.Hair)); foreach (Condition.Hair h in hairsArray) { allHairs.Add (h); } Array pantsArray = Enum.GetValues (typeof(Condition.Pant)); foreach (Condition.Pant p in pantsArray) { allPants.Add (p); } Array skinsArray = Enum.GetValues (typeof(Condition.Skin)); foreach (Condition.Skin s in skinsArray) { allSkins.Add (s); } beingText.SetActive(true); }