diff --git a/source/Trek-12/Models/Game/Dice.cs b/source/Trek-12/Models/Game/Dice.cs
index 2d47fe3..36bfd33 100644
--- a/source/Trek-12/Models/Game/Dice.cs
+++ b/source/Trek-12/Models/Game/Dice.cs
@@ -14,12 +14,12 @@ namespace Models.Game
///
/// Lowest number on the dice.
///
- public int NbMin { get; private set; }
+ public int MinVal { get; private set; }
///
/// Highest number on the dice.
///
- public int NbMax { get; private set; }
+ public int MaxVal { get; private set; }
///
/// Value of the dice.
@@ -29,9 +29,9 @@ namespace Models.Game
get => _value;
private set
{
- if (value < NbMin || value > NbMax)
+ if (value < MinVal || value > MaxVal)
{
- value = NbMin;
+ value = MinVal;
}
_value = value;
}
@@ -40,13 +40,13 @@ namespace Models.Game
///
/// Initializes a new instance of the class.
///
- /// The lowest number on the dice, on which the highest number is set
- public Dice(int nbmin)
+ /// The lowest number on the dice, on which the highest number is set
+ public Dice(int minval)
{
- if (nbmin < 0) nbmin = 0;
- if (nbmin > 1) nbmin = 1;
- NbMin = nbmin;
- NbMax = nbmin + 5;
+ if (minval < 0) minval = 0;
+ if (minval > 1) minval = 1;
+ MinVal = minval;
+ MaxVal = minval + 5;
}
///
@@ -54,13 +54,13 @@ namespace Models.Game
///
public Dice()
{
- NbMin = 0;
- NbMax = 5;
+ MinVal = 0;
+ MaxVal = 5;
}
public override string ToString()
{
- return $"Ce dé a pour valeur {Value} et est entre {NbMin} et {NbMax}";
+ return $"Ce dé a pour valeur {Value} et est entre {MinVal} et {MaxVal}";
}
///
@@ -68,7 +68,7 @@ namespace Models.Game
///
public void Roll()
{
- Value = new Random().Next(NbMin, NbMax + 1);
+ Value = new Random().Next(MinVal, MaxVal + 1);
}
///
diff --git a/source/Trek-12/Tests/DiceTests.cs b/source/Trek-12/Tests/DiceTests.cs
index 7831db6..22ded18 100644
--- a/source/Trek-12/Tests/DiceTests.cs
+++ b/source/Trek-12/Tests/DiceTests.cs
@@ -13,30 +13,30 @@ public class DiceTests
public void Constructor_WithNegativeNbMin_SetsNbMinToZero()
{
Dice dice = new Dice(-1);
- Assert.Equal(0, dice.NbMin);
+ Assert.Equal(0, dice.MinVal);
}
[Fact]
public void Constructor_WithNbMinGreaterThanOne_SetsNbMinToOne()
{
Dice dice = new Dice(2);
- Assert.Equal(1, dice.NbMin);
+ Assert.Equal(1, dice.MinVal);
}
[Fact]
public void Constructor_WithValidNbMin_SetsNbMinAndNbMaxCorrectly()
{
Dice dice = new Dice(1);
- Assert.Equal(1, dice.NbMin);
- Assert.Equal(6, dice.NbMax);
+ Assert.Equal(1, dice.MinVal);
+ Assert.Equal(6, dice.MaxVal);
}
[Fact]
public void DefaultConstructor_SetsNbMinToZeroAndNbMaxToFive()
{
Dice dice = new Dice();
- Assert.Equal(0, dice.NbMin);
- Assert.Equal(5, dice.NbMax);
+ Assert.Equal(0, dice.MinVal);
+ Assert.Equal(5, dice.MaxVal);
}
[Fact]
@@ -44,6 +44,6 @@ public class DiceTests
{
Dice dice = new Dice();
dice.Roll();
- Assert.True(dice.Value >= dice.NbMin && dice.Value <= dice.NbMax);
+ Assert.True(dice.Value >= dice.MinVal && dice.Value <= dice.MaxVal);
}
}