示例#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);
        }
 public void SetShouldThrowWhenCalledWithNegativeScoreValue()
 {
   sut = new CategoryScore(ScoreCategory.Aces);
   Assert.Throws<ArgumentOutOfRangeException>(delegate ()
   {
     sut.Set(-2, new List<int>() { 1, 1, 1, 1, 1 });
   });
 }
 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
   });
 }
 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.
   });
 }
    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);
    }
    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++]));
    }
 public void SetShouldNotThrowWhenCalledWithValidArguments()
 {
   sut = new CategoryScore(ScoreCategory.Aces);
   List<int> faceValues = new List<int>() { 1, 1, 1, 1, 1 };
   sut.Set(25, faceValues);
 }