Exemplo n.º 1
0
  /**
   * Tests the '{@link
   * no.hal.pg.quiz.runtime.service.QuizTaskService#proposeAnswer(no.hal.pg.runtime.Player,
   * no.hal.pg.quiz.model.QA, java.lang.String) <em>Propose Answer</em>}' operation.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see no.hal.pg.quiz.runtime.service.QuizTaskService#proposeAnswer(no.hal.pg.runtime.Player,
   *     no.hal.pg.quiz.model.QA, java.lang.String)
   * @generated NOT
   */
  public void testProposeAnswer__QA_String() {
    QuizTaskService service = getFixture();
    QuizTask quizTask = service.getContext();
    quizTask.start();

    Player player = quizTask.getAllPlayers().get(0);
    service.setSubject(player.getPerson());
    assertNull(service.proposeAnswer(quizTask.getProposals().get(0).getQa(), "Hallvard"));
    QuizTaskTest.checkProposeAnswer(quizTask, 0, null, 0, false);

    assertNull(service.proposeAnswer(quizTask.getProposals().get(3).getQa(), "true"));
    QuizTaskTest.checkProposeAnswer(quizTask, 3, null, 0, false);
  }
Exemplo n.º 2
0
  private QuizTaskService createQuizTaskService() {
    TestHelper testHelper =
        new TestHelper(
            this,
            ModelPackage.eINSTANCE,
            RuntimePackage.eINSTANCE,
            no.hal.pg.quiz.model.ModelPackage.eINSTANCE,
            no.hal.pg.quiz.runtime.RuntimePackage.eINSTANCE);
    testHelper.registerResourceFactory("jquiz", new RuntimeResourceFactoryImpl());

    testHelper.registerResourceFactory("jquiz", new ModelResourceFactoryImpl());
    testHelper.addResource(
        URI.createURI("test:/../../tests/QuizTaskTest.jquiz"), QuizTaskTest.createSimpleTestQuiz());
    return (QuizTaskService)
        testHelper.loadTestResource(ServicePackage.eINSTANCE.getQuizTaskService());
  }