Exception de la Class code
continuous-integration/drone/push Build is passing Details

master
Camille TURPIN-ETIENNE 12 months ago
parent 9d5686ad97
commit e0ad921724

@ -18,8 +18,8 @@
public void AjouterJeton(Jeton jeton)
{
if (NbJetons >= TailleMaximale() )
throw new CodeTailleTableauLesJetonsException();
if (EstComplet())
throw new CodeTailleTableauLesJetonsCompletException();
lesJetons[NbJetons++] = jeton;
}
@ -27,7 +27,7 @@
public void SupprimerDernierJeton()
{
if(NbJetons <= 0)
throw new CodeTailleTableauLesJetonsException();
throw new CodeTableauLesJetonsVideException();
lesJetons[NbJetons--] = null;
}
@ -35,12 +35,12 @@
public Jeton RecupererJeton(int indice)
{
if(indice < 0 || indice > TailleMaximale())
throw new CodeIndiceInvalideException();
throw new CodeIndiceHorsDePortéeException();
Jeton? jeton = lesJetons[indice];
if (!jeton.HasValue)
throw new CodeJetonInvalideException();
throw new CodeJetonNullException();
return jeton.Value;
}
@ -63,8 +63,8 @@
public IEnumerable<Indicateur> Comparer(Code autreCode)
{
// Mon code est le code correct, l'autre code est celui qui teste
if (autreCode.NbJetons <= TailleMaximale() )
throw new CodeTailleTableauLesJetonsException();
if (!autreCode.EstComplet())
throw new CodeTailleTableauLesJetonsCompletException();
Indicateur[] indicateurs = [];

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CoreLibrary
{
public class CodeIndiceHorsDePortéeException : Exception
{
public CodeIndiceHorsDePortéeException() : base("L'indice pointe en dehors du tableau")
{ }
}
}

@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CoreLibrary
{
public class CodeIndiceInvalideException : Exception
{
public CodeIndiceInvalideException() { }
public CodeIndiceInvalideException(string message)
: base(message) { }
public CodeIndiceInvalideException(string message, Exception inner)
: base(message, inner) { }
}
}

@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CoreLibrary
{
internal class CodeJetonInvalideException : Exception
{
public CodeJetonInvalideException() { }
public CodeJetonInvalideException(string message)
: base(message) { }
public CodeJetonInvalideException(string message, Exception inner)
: base(message, inner) { }
}
}

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CoreLibrary
{
internal class CodeJetonNullException : Exception
{
public CodeJetonNullException() : base("le jeton est null")
{ }
}
}

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CoreLibrary
{
public class CodeTableauLesJetonsIncompletException : Exception
{
public CodeTableauLesJetonsIncompletException() : base("Le tableau des jetons est incomplet")
{ }
}
}

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CoreLibrary
{
public class CodeTableauLesJetonsVideException : Exception
{
public CodeTableauLesJetonsVideException() : base("Le tableau des jetons est vide")
{ }
}
}

@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CoreLibrary
{
public class CodeTailleTableauException : Exception
{
public CodeTailleTableauException() { }
public CodeTailleTableauException(string message)
: base(message) { }
public CodeTailleTableauException(string message, Exception inner)
: base(message, inner) { }
}
}

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CoreLibrary
{
public class CodeTailleTableauLesJetonsCompletException : Exception
{
public CodeTailleTableauLesJetonsCompletException() : base("Le tableau des jetons est plein")
{ }
}
}

@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CoreLibrary
{
public class CodeTailleTableauLesJetonsException : Exception
{
public CodeTailleTableauLesJetonsException() { }
public CodeTailleTableauLesJetonsException(string message)
: base(message) { }
public CodeTailleTableauLesJetonsException(string message, Exception inner)
: base(message, inner) { }
}
}

@ -53,12 +53,12 @@
{
if (code.TailleMaximale() != tailleCode)
{
throw new CodeTailleMaximaleException();
throw new PlateauTailleCodeException();
}
if (!code.EstComplet())
{
throw new CodeIncompletException();
throw new PlateauCodeIncompletException();
}
indicateurs[Tour - 1] = codeSecret.Comparer(code);

Loading…
Cancel
Save