From 3509691f9f3907ac6b829d794967f0c39dd031ec Mon Sep 17 00:00:00 2001 From: Aptivi CEO Date: Mon, 24 Jul 2023 19:25:12 +0300 Subject: [PATCH] add - Added name count checking We've added name count checking --- We need to check to see if we have any names. If we don't have any names or any surname, we'll throw an error message. --- Type: add Breaking: False Doc Required: False Part: 1/1 --- Namer/NameGenerator.cs | 6 ++++++ Namer/Namer.csproj | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Namer/NameGenerator.cs b/Namer/NameGenerator.cs index 370c301..9088c21 100644 --- a/Namer/NameGenerator.cs +++ b/Namer/NameGenerator.cs @@ -127,6 +127,12 @@ public static List GenerateNames(int Count, string NamePrefix, string Na else if (NameSuffixCheckRequired) ProcessedSurnames = Surnames.Where((str) => str.EndsWith(SurnameSuffix)).ToArray(); + // Check the names and the surnames + if (ProcessedNames.Length == 0) + throw new Exception("The names are not found! Please ensure that the name conditions are correct."); + if (ProcessedSurnames.Length == 0) + throw new Exception("The surnames are not found! Please ensure that the surname conditions are correct."); + // Select random names for (int NameNum = 1; NameNum <= Count; NameNum++) { diff --git a/Namer/Namer.csproj b/Namer/Namer.csproj index ee7aef7..155b3ca 100644 --- a/Namer/Namer.csproj +++ b/Namer/Namer.csproj @@ -3,8 +3,8 @@ netstandard2.0 True - 1.0.0.2 - 1.0.0.2 + 1.0.0.3 + 1.0.0.3 Aptivi Aptivi Name generation tool