Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
bin
obj
TestResults
test-results
*~
*.swp
*.suo
*.suo
*.pidb
*.userprefs
4 changes: 4 additions & 0 deletions Faker.Mono.sln
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,9 @@ Global
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Faker.Net\Faker.Mono.csproj
Policies = $0
$0.StandardHeader = $1
$1.Text = @\n Author:\n ${AuthorName} ${AuthorEmail}\n\n Copyright (c) ${Year}, ${CopyrightHolder}\n\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in\n the documentation and/or other materials provided with the distribution.\n * Neither the name of the [ORGANIZATION] nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n
$1.IncludeInNewFiles = True
EndGlobalSection
EndGlobal
5 changes: 2 additions & 3 deletions Faker.Net.NUnit.Tests/Faker.Mono.NUnit.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<OutputType>Library</OutputType>
<RootNamespace>Faker.Tests</RootNamespace>
<AssemblyName>Faker.Tests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -31,8 +30,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="nunit.framework, Version=2.6.0.12051, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
<SpecificVersion>False</SpecificVersion>
<Reference Include="nunit.framework">
<HintPath>..\NUnit\nunit.framework.dll</HintPath>
</Reference>
</ItemGroup>
Expand All @@ -52,6 +50,7 @@
<Compile Include="AddressTests.cs" />
<Compile Include="InternetTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="NameSNTests.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
Expand Down
34 changes: 34 additions & 0 deletions Faker.Net.NUnit.Tests/NameSNTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using NUnit;
using NUnit.Framework;
using System.Text.RegularExpressions;

namespace Faker.Tests
{
[TestFixture]
public class NameSNTests
{
[Test]
public void TestFirstNameMale ()
{
Assert.IsTrue (Regex.IsMatch (NameSN.FirstNameMale, @"\w{2,}"));
Assert.IsTrue (NameSN.FIRST_NAMES_MALE.Contains (NameSN.FirstNameMale));
}

[Test]
public void TestFirstNameFeMale ()
{
Assert.IsTrue (Regex.IsMatch (NameSN.FirstNameFemale, @"\w{2,}"));
Assert.IsTrue (NameSN.FIRST_NAMES_FEMALE.Contains (NameSN.FirstNameFemale));
}

[Test]
public void TestLastName ()
{
Assert.IsTrue (Regex.IsMatch (NameSN.LastName, @"\w{2,}"));
Assert.IsTrue (NameSN.LAST_NAMES.Contains (NameSN.LastName));
}

}
}

65 changes: 65 additions & 0 deletions Faker.Net/Extensions/ArrayExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
//
// Author:
// Papa Pathe SENE pathe.sene@gmail.com
//
// Copyright (c) 2012, Papa Pathe SENE
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in
// the documentation and/or other materials provided with the distribution.
// * Neither the name of the [ORGANIZATION] nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
using System;

namespace Faker
{
public static class ArrayExtensions
{

/// <summary>
/// Assert that the Array Contains the specified item.
/// </summary>
/// <param name='array'>
/// An Array
/// </param>
/// <param name='str'>
/// The item to search in the Array
/// </param>
/// <typeparam name='T'>
/// A generic Type
/// </typeparam>
public static bool Contains<T> (this T[] array, T criteria) where T : IEquatable<T>
{
/// Declare a boolean variable initialized to false
bool found = false;

/// Loop through the array an compare each item in the list with the search criteria
/// Exit the loop when a match in found
foreach (T item in array) {
if (item.Equals (criteria)) {
found = true;
break;
}
}

return found;
}
}
}

3 changes: 2 additions & 1 deletion Faker.Net/Faker.Mono.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<OutputType>Library</OutputType>
<RootNamespace>Faker</RootNamespace>
<AssemblyName>Faker</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -46,6 +45,8 @@
<Compile Include="Extensions\StringExtensions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Extensions\NumberExtensions.cs" />
<Compile Include="NameSN.cs" />
<Compile Include="Extensions\ArrayExtensions.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down
80 changes: 80 additions & 0 deletions Faker.Net/NameSN.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using Faker.Extensions;

namespace Faker
{
/// <summary>
/// Name SN brings names from west africa senegal
/// </summary>
public static class NameSN
{

#region Fields

/// <summary>
/// The first names for males
/// </summary>
public static readonly string[] FIRST_NAMES_MALE = new string[] {
"Abba","Abdallah","Abdou","Abdoulatif","Abdoulaye","Abdourahmane","Ablaye","Abou","Adama","Agouloubene","Aïnina","Aladji","Alassane","Albouri","Alfa","Alfousseyni","Aliou","Alioune","Allé","Almamy","Amadou","Amara","Amath","Amidou","Ansoumane","Anta","Arfang","Arona","Assane","Ass","Aziz","Baaba","Babacar","Babou","Badara","Badou","Bacar","Baïdi","Baila","Bakari","Ballago","Balla","Bamba","Banta","Bara","Bassirou","Bathie","Bayo","Becaye","Bilal","Biram","Birane","Birima","Biry","Bocar","Bodiel","Bolikoro","Boubacar","Boubou","Bougouma","Bouly","Bouna","Bourkhane","Bransan","Cheikh","Chérif","Ciré","Daly","Dame","Daouda","Daour","Demba","Dényanké","Diakhou","Dial","Dialamba","Dialegueye","Dianco","Dicory","Diégane","Diène","Dierry","Diokel","Diokine","Diomaye","Djibo","Djibril","Djiby","Doudou","Dramane","ElHadj","Elimane","Facourou","Fadel","Falilou","Fallou","Famara","Farba","Fatel","Fodé","Fodey","Fodié","Foulah","Galaye","Gaoussou","Gora","Gorgui","Goumbo","Goundo","Guidado","Habib","Hadiya","Hady","Hamidou","Hammel","Hatab","Iba","Ibrahima","Ibou","Idrissa","Insa","Ismaïl","Ismaïla","Issa","Isshaga","Jankebay","Jamuyon","Kader","Kainack","Kalidou","Kalilou","Kambia","Kao","Kaourou","Karamo","Kéba","Khadim","Khadir","Khalifa","Khamby","Khary","Khoudia","Khoule","Kor","Koutoubo","Lamine","Lamp","Landing","Lat","Latif","Latsouck","Latyr","Lémou","Léou","Leyti","Libasse","Limane","Loumboul","Maba","Macky","Macodou","Madia","Madické","Mady","Mactar","Maffal","Maguette","Mahécor","Makan","Malal","Malamine","Malang","Malaw","Malick","Mallé","Mamadou","Mamour","Mansour","Maodo","Mapaté","Mar","Massamba","Massar","Masseck","Mbagnick","Mbakhane","Mbamoussa","Mbar","Mbaye","Mébok","Médoune","Meïssa","Modou","Moktar","Momar","Mor","Mountaga","Moussa","Moustapha","Namori","Ndane","Ndiack","Ndiaga","Ndiankou","Ndiaw","Ndiawar","Ndiaya","Ndiogou","Ndiouga","Ndongo","Ngagne","Ngor","Nguénar","Niakar","Niankou","Niokhor","Nouh","Nouha","Npaly","Ogo","Omar","Opa","Oumar","Oury","Ousmane","Ousseynou","Papa","Pape","Papis","Pathé","Racine","Sadibou","Sacoura","Saër","Sahaba","Saïdou","Sakhir","Salam","Salif","Saliou","Saloum","Samba","Samori","Samsidine","Sandigui","Sankoun","Sanokho","Sécouba","Sédar","Sékou","Semou","Senghane","Serigne","Seyba","Seydina","Seydou","Sibiloumbaye","Sidate","Sidy","Siéka","Sihalébé","Sihounke","Silly","Socé","Sogui","Soireba","Solal","Sonar","Souleymane","Soundjata","Sounkarou","Souty","Tafsir","Talla","Tamsir","Tanor","Tayfor","Tekheye","Tété","Thiawlo","Thierno","Thione","Tijane","Tidjane","Toumani","Vieux","Wagane","Waly","Wandifing","Wasis","Woula","Woury","Yacouba","Yafaye","Yakou","Yankhoba","Yerim","Yero","Yoro","Yougo","Younouss","Youssou","Yussu","Youssoufa"
};

/// <summary>
/// The first names for females
/// </summary>
public static readonly string[] FIRST_NAMES_FEMALE = new string[] {
"Abibatou","Aby","Absa","Adama","Adiouma","Adji","Adja","Aïcha","Aïda","Aïssatou","Akinumelob","Alima","Alimatou","Aline Siitowe","Aloendisso","Altine","Ama","Aminata","Aminta","Amy","Amina","Anta","Arame","Assa","Assietou","Astou","Ata","Atia","Awa","Awentorébé","Ayimpen","Banel","Batouly","Bigué","Billé","Binta","Bineta","Binette","Binta","Bintou","Borika","Bougouma","Boury","Bousso","Ciramadi","Codou","Combé","Coudouution","Coumba","Coumboye","Coura","Daba","Dado","Daka","Debbo","Défa","Dewel","Dewene","Diakher","Diakhou","Dialikatou","Dianké","Diariatou","Diarra","Diary","Dibor","Dieourou","Dior","Diouma","Djaly","Djébou","Djeynaba","Dkikel","Djilane","Enfadima","Fabala","Fabinta","Fadima","Fakane","Fama","Fanta","Farmata","Fatima","Fatou","Fatoumatou","Fily","Garmi","Gnagna","Gnilane","Gnima","Gouya","Guignane","Guissaly","Haby","Hawa","Heinda","Holèl","Issate","Kankou","Karimatou","Kenbougoul","Kéwé","Kadiali","Khadija","Khadijatou","Khady","Khar","Khary","Khayfatte","Khoudia","Khoudjedji","Khoumbaré","Kiné","Korka","Laf","Lama","Léna","Lika","Lissah","Liwane","Mada","Madior","Madjiguène","Maguette","Mahawa","Mame","Mamina","Manthita","Marème","Mariama","Mamassa","Mane","Maty","Mayatta","Maymouna","Mbarou","Mbayeng","Mbissine","Mbossé","Mingue","Mintou","Mouskéba","Nafi","Nbieumbet","Ndella","Ndeye","Ndiarenioul","Ndiasse","Ndiaty","Ndiémé","Ndioba","Ndiolé","Ndioro","Ndombo","Néné","Neyba","Ngoné","Ngosse","Nguenar","Nguissaly","Niakuhufosso","Niali","Nialine","Ningou","Nini","Niouma","Oulèye","Ouly","Oulimata","Oumou","Oumy","Oureye","Penda","Raby","Raki","Rama","Ramatoulaye","Ramata","Rokhaya","Roubba","Roughy","Sadio","Safiétou","Safi","Sagar","Sahaba","Salimata","Salamata","Sanakha","Sarratou","Saoudatou","Sawdiatou","Selbé","Sell","Seynabou","Seyni","Sibett","Siga","Sira","Sirabiry","Soda","Sofiatou","Sofietou","Sokhna","Souadou","Soukeye","Soukeyna","Tabara","Tacko","Taki","Tening","Téwa","Tiné","Thiomba","Thiony","Thioro","Thioumbane","Tocka","Tokoselle","Toly","Walty","Yadicone","Yacine","Yandé","Yaye"
};
public static readonly string[] LAST_NAMES = new string[] {
"Badji","Badiatte","Badji","Biagui","Bassène","Bodian","Coly","Diamacoune","Diatta","Diadhiou","Diédhiou","Deme","Diémé","Djiba","Ehemba","Goudiaby","Himbane","Mané","Manga","Sagna","Sambou","Sané","Sonko","Tamba","Tendeng","Badji","Gomis","Mané","Vieira","Carvalho","Mendy","Mané","Preira","Correia","Basse","Sylva","Da_Sylva","Fernandez","Da_Costa","Bakhoum","Diop","Diagne","Gaye","Gueye","Ndoye","Ndiour","Samb","Baloucoune","Bandiacky","Boissy","Diompy","Dupa","Kabely","Kaly","Kantoussan","Kassoka","Kayounga","Keny","Malack","Malèle","Malomar","Malou","Mandika","Mandiouban","Mancabou","Mantanne","Mbampassy","Médou","Minkette","Nabaline","Nadiack","Napel","Ndecky","Ndeye","Niouky","Ntab","Nzale","Panduppy","Samy","Boubane","Bonang","Bianquinch","Bindian","Bendian","Bangonine","Bapinye","Bidiar","Bangar","Sadio","Vieira","Lopez","Marques","Preira","Ndiaye","Diouf","Ndong","Dioh","Senghor","Faye","Dior","Dione","Seye","Diongue","Sene","Dieye","Sarr","Seck","Diaher","Bop","Kitane","Kital","Acc","Aïdara","Athie","Aw","Ba","Baby","Baldé","Barro","Barry","Bathily","Bousso","Camara","Cissé","Dia","Diamanka","Diallo","Diao","Diaw","Fassa","Fofana","Gadio","Galadio","Kâ","Kane","Maal","Mbow","Lo","Ly","Sall","Seydi","Sow","Sy","Sylla","Tall","Thiam","Wane","Wone","Yock","Amar","Babou","Diagne","Diakhoumpa","Goumbala","Saady","Sabara","Sougou","Sougoufara","Tandiné","Tandini","Touré","Diandy","Aïdara","Bathily","Camara","Cissé","Cissoko","Coulibaly","Dabo","Doumbia","Doumbouya","Diabang","Diakhaté","Diabira","Diakité","Dansokho","Diakho","Diarra","Diawara","Djimera","Dramé","Doucouré","Fadiga","Fofana","Gakou","Gandega","Kanté","Kanouté","Keïta","Koïta","Konaté","Niangane","Sadio","Sakho","Samassa","Sawane","Sidibé","Sissoko","Soumaré","Tandjigora","Timera","Traoré","Touré","Wagué","Yatéra","Boye","Demba","Dembelé","Diack","Diarra","Dieng","Diop","Fall","Gningue","Hanne","Kane","Kassé","Lèye","Loum","Marone","Mbathié","Mbaye","Mbengue","Mbodj","Mbodji","Mboup","Mbow","Ndao","Ndaw","Nder","Ndiaye","Ndour","Niane","Niang","Niass","Niasse","Pouye","Seck","Sock","Taye","Thiam","Thiongane","Wade"
};

#endregion

#region Properties

/// <summary>
/// Gets a first name for male.
/// </summary>
/// <returns>
/// The name.
/// </returns>
/// <code>
/// string aname = Faker.NameSN.FirstNameMale
/// </code>
public static string FirstNameMale {
get {
return FIRST_NAMES_MALE.Rand ();
}
}

/// <summary>
/// Gets a first name of a female.
/// </summary>
/// <value>
/// The first name female.
/// </value>
public static string FirstNameFemale {
get {
return FIRST_NAMES_FEMALE.Rand ();
}
}

/// <summary>
/// Gets the last name.
/// </summary>
/// <value>
/// The last name.
/// </value>
public static string LastName {
get {
return LAST_NAMES.Rand ();
}
}

#endregion


}
}