コード例 #1
0
        private CategoryScore BuildCategoryScore(ScoreCategory a_scoreCategory, int a_score, List <int> a_faceValues)
        {
            CategoryScore categoryScore = new CategoryScore(a_scoreCategory);

            categoryScore.Set(a_score, a_faceValues);
            return(categoryScore);
        }
コード例 #2
0
 public void SetShouldThrowWhenCalledWithNegativeScoreValue()
 {
   sut = new CategoryScore(ScoreCategory.Aces);
   Assert.Throws<ArgumentOutOfRangeException>(delegate ()
   {
     sut.Set(-2, new List<int>() { 1, 1, 1, 1, 1 });
   });
 }
コード例 #3
0
 public void SetShouldThrowWhenCalledWithAnyInvalidDiceFaceValues()
 {
   sut = new CategoryScore(ScoreCategory.Aces);
   Assert.Throws<InvalidDieException>(delegate ()
   {
     sut.Set(25, new List<int>() { -1, -1, 9, 8, 1 }); // [1..6] is valid
   });
 }
コード例 #4
0
 public void SetShouldThrowWhenCalledWithInvalidNumberOfDiceFaceValues()
 {
   sut = new CategoryScore(ScoreCategory.Aces);
   Assert.Throws<ArgumentOutOfRangeException>(delegate ()
   {
     sut.Set(25, new List<int>() { 1, 1, 1 }); // 5 or 6 dice is valid.
   });
 }
コード例 #5
0
    public void ShouldReturnGivenScore()
    {
      int expected = 25;

      sut = new CategoryScore(ScoreCategory.Aces);
      sut.Set(expected, new List<int>() { 1, 1, 1, 1, 1 });

      int actual = sut.Score;

      Assert.Equal(expected, actual);
    }
コード例 #6
0
    public void ShouldReturnGivenFaceValues()
    {
      int i = 0;
      List<int> expected = new List<int>() { 1, 1, 1, 1, 1 };

      sut = new CategoryScore(ScoreCategory.Aces);
      sut.Set(25, expected);

      IReadOnlyList<int> actual = sut.FaceValues;

      // TODO: Refactor this later.
      Assert.True(actual.All(x => x == expected[i++]));
    }
コード例 #7
0
 public void SetShouldNotThrowWhenCalledWithValidArguments()
 {
   sut = new CategoryScore(ScoreCategory.Aces);
   List<int> faceValues = new List<int>() { 1, 1, 1, 1, 1 };
   sut.Set(25, faceValues);
 }