✒️ Traduction et factorisation
continuous-integration/drone/push Build is failing Details
continuous-integration/drone/pr Build is failing Details

pull/56/head
Rémi LAVERGNE 12 months ago
parent 619cdaf3cc
commit 0ac2b5bc0f
No known key found for this signature in database
GPG Key ID: CA264B55E97FD220

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Models.Game
{
public class De
public class Dice
{
public int NbMin { get; private set; }
@ -14,7 +14,7 @@ namespace Models.Game
public int Nb { get; private set; }
public De(int nbmin)
public Dice(int nbmin)
{
if (nbmin < 0) nbmin = 0;
if (nbmin > 1) nbmin = 1;
@ -22,7 +22,7 @@ namespace Models.Game
NbMax = nbmin + 5;
}
public De()
public Dice()
{
NbMin = 0;
NbMax = 5;
@ -38,10 +38,9 @@ namespace Models.Game
Nb = new Random().Next(NbMin, NbMax + 1);
}
public bool IsLower(De de1)
public bool IsLower(Dice dice2)
{
if (de1.Nb > this.Nb) return true;
else return false;
return dice2.Nb > this.Nb;
}
}
}

@ -7,12 +7,12 @@ using Models.Game;
namespace Tests;
public class DeTest
public class DiceTest
{
[Fact]
public void TestConstructor()
{
De d = new De();
Dice d = new Dice();
Assert.NotNull(d);
Assert.Equal(0, d.NbMin);
Assert.Equal(5, d.NbMax);
@ -21,7 +21,7 @@ public class DeTest
[Fact]
public void TestConstructorRebelotteWithInvalidNbMin()
{
De d = new De(2);
Dice d = new Dice(2);
Assert.NotNull(d);
Assert.Equal(1, d.NbMin);
Assert.Equal(6, d.NbMax);
@ -30,7 +30,7 @@ public class DeTest
[Fact]
public void TestConstructorReRebelotteWithAnotherInvalidNbMin()
{
De d = new De(-2);
Dice d = new Dice(-2);
Assert.NotNull(d);
Assert.Equal(0, d.NbMin);
Assert.Equal(5, d.NbMax);
@ -39,7 +39,7 @@ public class DeTest
[Fact]
public void TestConstructorRebelotteWithValidNbMin()
{
De d = new De(1);
Dice d = new Dice(1);
Assert.NotNull(d);
Assert.Equal(1, d.NbMin);
Assert.Equal(6, d.NbMax);
@ -48,7 +48,7 @@ public class DeTest
[Fact]
public void TestConstructorRebelotteWithAnotherValidNbMin()
{
De d = new De(0);
Dice d = new Dice(0);
Assert.NotNull(d);
Assert.Equal(0, d.NbMin);
Assert.Equal(5, d.NbMax);
@ -57,7 +57,7 @@ public class DeTest
[Fact]
public void TestLancer()
{
De d = new De();
Dice d = new Dice();
Assert.NotNull(d);
Assert.IsType<int>(d.Nb);
Assert.InRange(d.Nb, d.NbMin, d.NbMax);
Loading…
Cancel
Save