コード例 #1
0
ファイル: SoccerTest.java プロジェクト: squallco/Score
  /** Test method for {@link fr.squallco.score.model.Soccer#isShootOutMode()}. */
  @Test
  public void testShootOutMode() {
    // Activate
    mSoccerModel.setShootOutMode(true);
    assertTrue(mSoccerModel.isShootOutMode());

    // Deactivate
    mSoccerModel.setShootOutMode(false);
    assertFalse(mSoccerModel.isShootOutMode());

    // No activation if scores aren't equal
    mSoccerModel.setHomeScorePlus1();
    mSoccerModel.setShootOutMode(true);
    assertFalse(mSoccerModel.isShootOutMode());

    // Activation if scores are equal
    mSoccerModel.setVisitorScorePlus1();
    mSoccerModel.setShootOutMode(true);
    assertTrue(mSoccerModel.isShootOutMode());
  }
コード例 #2
0
ファイル: SoccerTest.java プロジェクト: squallco/Score
  /** Test method for {@link fr.squallco.score.model.Soccer#setHomeScorePlus1()}. */
  @Test
  public void testSetHomeScorePlus1() {
    // Add 1 to score
    mSoccerModel.setHomeScorePlus1();
    assertEquals(1, mSoccerModel.getHomeScore());

    // Add 1 to shoot-out score in shoot-out mode
    mSoccerModel.setVisitorScorePlus1();
    mSoccerModel.setShootOutMode(true);
    mSoccerModel.setHomeScorePlus1();
    assertEquals(1, mSoccerModel.getHomeShootOutScore());

    // Check that shoot-out score doesn't go over 99
    for (int i = 0; i < 100; i++) {
      mSoccerModel.setHomeScorePlus1();
    }
    assertEquals(99, mSoccerModel.getHomeShootOutScore());

    // Check that score doesn't go over 99
    mSoccerModel.setShootOutMode(false);
    for (int i = 0; i < 100; i++) {
      mSoccerModel.setHomeScorePlus1();
    }
    assertEquals(99, mSoccerModel.getHomeScore());
  }
コード例 #3
0
ファイル: SoccerTest.java プロジェクト: squallco/Score
 /** Test method for {@link fr.squallco.score.model.Soccer#getVisitorShootOutScore()}. */
 @Test
 public void testGetVisitorShootOutScore() {
   assertEquals(0, mSoccerModel.getVisitorShootOutScore());
 }
コード例 #4
0
ファイル: SoccerTest.java プロジェクト: squallco/Score
 /** Test method for {@link fr.squallco.score.model.Soccer#getHomeScore()}. */
 @Test
 public void testGetHomeScore() {
   assertEquals(0, mSoccerModel.getHomeScore());
 }
コード例 #5
0
ファイル: SoccerTest.java プロジェクト: squallco/Score
 /** Test method for {@link fr.squallco.score.model.Soccer#getScoreIdentifier()}. */
 @Test
 public void testGetScoreIdentifier() {
   assertEquals(ScoreIdentifier.SOCCER, mSoccerModel.getScoreIdentifier());
 }
コード例 #6
0
ファイル: SoccerTest.java プロジェクト: squallco/Score
  /** Test method for {@link fr.squallco.score.model.Soccer#resetScore()}. */
  @Test
  public void testResetScore() {
    mSoccerModel.setHomeScorePlus1();
    mSoccerModel.setVisitorScorePlus1();
    mSoccerModel.setShootOutMode(true);
    mSoccerModel.setHomeScorePlus1();
    mSoccerModel.setVisitorScorePlus1();

    mSoccerModel.resetScore();

    assertEquals(0, mSoccerModel.getHomeScore());
    assertEquals(0, mSoccerModel.getVisitorScore());
    assertEquals(0, mSoccerModel.getHomeShootOutScore());
    assertEquals(0, mSoccerModel.getVisitorShootOutScore());
    assertFalse(mSoccerModel.isShootOutMode());
  }
コード例 #7
0
ファイル: SoccerTest.java プロジェクト: squallco/Score
  /** Test method for {@link fr.squallco.score.model.Soccer#setVisitorScoreMinus1()}. */
  @Test
  public void testSetVisitorScoreMinus1() {
    // Remove 1 from score
    mSoccerModel.setVisitorScorePlus1();
    mSoccerModel.setVisitorScoreMinus1();
    assertEquals(0, mSoccerModel.getVisitorScore());

    // Check that score doesn't go under 0
    mSoccerModel.setVisitorScoreMinus1();
    assertEquals(0, mSoccerModel.getVisitorScore());

    // Remove 1 from shoot-out score
    mSoccerModel.setShootOutMode(false);
    mSoccerModel.setVisitorScorePlus1();
    mSoccerModel.setVisitorScoreMinus1();
    assertEquals(0, mSoccerModel.getVisitorShootOutScore());

    // Check that shoot-out score doesn't go under 0
    mSoccerModel.setVisitorScoreMinus1();
    assertEquals(0, mSoccerModel.getVisitorShootOutScore());
  }