Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
add - Added name count checking
Browse files Browse the repository at this point in the history
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
  • Loading branch information
AptiviCEO committed Jul 24, 2023
1 parent 8f69dcc commit 3509691
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Namer/NameGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ public static List<string> 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++)
{
Expand Down
4 changes: 2 additions & 2 deletions Namer/Namer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Version>1.0.0.2</Version>
<PackageVersion>1.0.0.2</PackageVersion>
<Version>1.0.0.3</Version>
<PackageVersion>1.0.0.3</PackageVersion>
<Authors>Aptivi</Authors>
<Company>Aptivi</Company>
<Description>Name generation tool</Description>
Expand Down

0 comments on commit 3509691

Please sign in to comment.