From f6e5af324b3ea46482c38ffe502f23832a822625 Mon Sep 17 00:00:00 2001 From: "pauline.prady" Date: Fri, 3 May 2024 17:19:23 +0200 Subject: [PATCH] Correction exception Plateau --- Sources/CoreLibrary/Plateau.cs | 7 ++++++- .../CoreLibrary/PlateauTailleCodeIncompleteException.cs | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 Sources/CoreLibrary/PlateauTailleCodeIncompleteException.cs diff --git a/Sources/CoreLibrary/Plateau.cs b/Sources/CoreLibrary/Plateau.cs index 3a78e43..b1c885f 100644 --- a/Sources/CoreLibrary/Plateau.cs +++ b/Sources/CoreLibrary/Plateau.cs @@ -51,7 +51,12 @@ public void AjouterCode(Code code) { - if (code.NbJetons < tailleCode || !code.EstComplet()) + if (code.NbJetons < tailleCode) + { + throw new PlateauTailleCodeIncompleteException(); + } + + if (!code.EstComplet()) { throw new PlateauCodeIncompletException(); } diff --git a/Sources/CoreLibrary/PlateauTailleCodeIncompleteException.cs b/Sources/CoreLibrary/PlateauTailleCodeIncompleteException.cs new file mode 100644 index 0000000..38133c7 --- /dev/null +++ b/Sources/CoreLibrary/PlateauTailleCodeIncompleteException.cs @@ -0,0 +1,7 @@ +namespace CoreLibrary +{ + public class PlateauTailleCodeIncompleteException : Exception + { + public PlateauTailleCodeIncompleteException() : base("Le code n'est pas remplit au maximum") { } + } +}