diff --git a/.gitignore b/.gitignore index 23e723f..e9bf680 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ bin obj TestResults +test-results *~ *.swp -*.suo \ No newline at end of file +*.suo +*.pidb +*.userprefs diff --git a/Faker.Mono.sln b/Faker.Mono.sln index 1ef6393..0dc4525 100644 --- a/Faker.Mono.sln +++ b/Faker.Mono.sln @@ -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 diff --git a/Faker.Net.NUnit.Tests/Faker.Mono.NUnit.Tests.csproj b/Faker.Net.NUnit.Tests/Faker.Mono.NUnit.Tests.csproj index a2b09cf..3bf6395 100644 --- a/Faker.Net.NUnit.Tests/Faker.Mono.NUnit.Tests.csproj +++ b/Faker.Net.NUnit.Tests/Faker.Mono.NUnit.Tests.csproj @@ -9,7 +9,6 @@ Library Faker.Tests Faker.Tests - v4.0 true @@ -31,8 +30,7 @@ - - False + ..\NUnit\nunit.framework.dll @@ -52,6 +50,7 @@ + diff --git a/Faker.Net.NUnit.Tests/NameSNTests.cs b/Faker.Net.NUnit.Tests/NameSNTests.cs new file mode 100644 index 0000000..44cde71 --- /dev/null +++ b/Faker.Net.NUnit.Tests/NameSNTests.cs @@ -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)); + } + + } +} + diff --git a/Faker.Net/Extensions/ArrayExtensions.cs b/Faker.Net/Extensions/ArrayExtensions.cs new file mode 100644 index 0000000..164b42f --- /dev/null +++ b/Faker.Net/Extensions/ArrayExtensions.cs @@ -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 + { + + /// + /// Assert that the Array Contains the specified item. + /// + /// + /// An Array + /// + /// + /// The item to search in the Array + /// + /// + /// A generic Type + /// + public static bool Contains (this T[] array, T criteria) where T : IEquatable + { + /// 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; + } + } +} + diff --git a/Faker.Net/Faker.Mono.csproj b/Faker.Net/Faker.Mono.csproj index 2d227d1..996a3da 100644 --- a/Faker.Net/Faker.Mono.csproj +++ b/Faker.Net/Faker.Mono.csproj @@ -9,7 +9,6 @@ Library Faker Faker - v4.0 true @@ -46,6 +45,8 @@ + + diff --git a/Faker.Net/NameSN.cs b/Faker.Net/NameSN.cs new file mode 100644 index 0000000..4dc7fa2 --- /dev/null +++ b/Faker.Net/NameSN.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using Faker.Extensions; + +namespace Faker +{ + /// + /// Name SN brings names from west africa senegal + /// + public static class NameSN + { + + #region Fields + + /// + /// The first names for males + /// + 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" + }; + + /// + /// The first names for females + /// + 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 + + /// + /// Gets a first name for male. + /// + /// + /// The name. + /// + /// + /// string aname = Faker.NameSN.FirstNameMale + /// + public static string FirstNameMale { + get { + return FIRST_NAMES_MALE.Rand (); + } + } + + /// + /// Gets a first name of a female. + /// + /// + /// The first name female. + /// + public static string FirstNameFemale { + get { + return FIRST_NAMES_FEMALE.Rand (); + } + } + + /// + /// Gets the last name. + /// + /// + /// The last name. + /// + public static string LastName { + get { + return LAST_NAMES.Rand (); + } + } + + #endregion + + + } +} +