Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.
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: 5 additions & 0 deletions src/Faker/Address.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ public static string UkPostCode()
return Resources.Address.UkPostCode.Split(Config.Separator).Random().Trim().Numerify().Letterify();
}

public static string Province()
{
return Resources.Address.Province.Split(Config.Separator).Random().Trim().Numerify().Letterify();
}

#region Format Mappings
private static readonly IEnumerable<Func<string>> _cityFormats = new List<Func<string>>
{
Expand Down
74 changes: 37 additions & 37 deletions src/Faker/Company.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
using System;
using System.Collections.Generic;
using Faker.Extensions;

namespace Faker
{
public static class Company
{
public static string Name()
{
return NameFormats.Random();
}

using System;
using System.Collections.Generic;
using Faker.Extensions;
namespace Faker
{
public static class Company
{
public static string Name()
{
return NameFormats.Random();
}
public static string Suffix()
{
return Resources.Company.Suffix.Split(Config.Separator).Random();
}

/// <summary>
/// Generate a buzzword-laden catch phrase.
/// Wordlist from http://www.1728.com/buzzword.htm
/// </summary>
return Resources.Company.Suffix.Split(Config.Separator).Random();
}
/// <summary>
/// Generate a buzzword-laden catch phrase.
/// Wordlist from http://www.1728.com/buzzword.htm
/// </summary>
public static string CatchPhrase()
{
return String.Join(" ",
Expand All @@ -29,12 +29,12 @@ public static string CatchPhrase()
Resources.Company.Buzzwords2.Split(Config.Separator).Random(),
Resources.Company.Buzzwords3.Split(Config.Separator).Random()
});
}

/// <summary>
/// When a straight answer won't do, BS to the rescue!
/// Wordlist from http://dack.com/web/bullshit.html
/// </summary>
}
/// <summary>
/// When a straight answer won't do, BS to the rescue!
/// Wordlist from http://dack.com/web/bullshit.html
/// </summary>
public static string BS()
{
return String.Join(" ",
Expand All @@ -44,15 +44,15 @@ public static string BS()
Resources.Company.BS2.Split(Config.Separator).Random(),
Resources.Company.BS3.Split(Config.Separator).Random()
});
}

#region Format Mappings
private static readonly IEnumerable<Func<string>> NameFormats = new List<Func<string>>
{
() => string.Format("{0} {1}", Faker.Name.Last(), Suffix()),
() => string.Format("{0}-{1}", Faker.Name.Last(), Faker.Name.Last()),
() => string.Format("{0}, {1} {2} {3}", Faker.Name.Last(), Faker.Name.Last(), Resources.Company.And, Faker.Name.Last()),
};
#endregion
}
}
#region Format Mappings
private static readonly IEnumerable<Func<string>> NameFormats = new List<Func<string>>
{
() => string.Format("{0} {1}", Faker.Name.Last(), Suffix()),
() => string.Format("{0}-{1}", Faker.Name.Last(), Faker.Name.Last()),
() => string.Format("{0}, {1} {2} {3}", Faker.Name.Last(), Faker.Name.Last(), Resources.Company.And, Faker.Name.Last()),
};
#endregion
}
}
23 changes: 23 additions & 0 deletions src/Faker/Enumeration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Faker.Extensions;

namespace Faker
{

public static class Enumeration
{

/// <summary>
/// Choose a random enum.
/// </summary>
public static T Random<T>()
where T : struct, IConvertible
{
var values = Enum.GetValues(typeof(T));
return (T)values
.GetValue(RandomNumber.Next(values.Length));
}
}
}
51 changes: 51 additions & 0 deletions src/Faker/Faker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,26 @@
<Compile Include="Extensions\StringExtensions.cs" />
<Compile Include="Internet.cs" />
<Compile Include="Lorem.cs" />
<Compile Include="Enumeration.cs" />
<Compile Include="Name.cs" />
<Compile Include="Phone.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RandomNumber.cs" />
<Compile Include="Resources\Address.pl-PL.Designer.cs">
<DependentUpon>Address.pl-PL.resx</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Resources\Address.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Address.resx</DependentUpon>
</Compile>
<Compile Include="Resources\Company.pl-PL.Designer.cs">
<DependentUpon>Company.pl-PL.resx</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Resources\Company.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
Expand All @@ -95,6 +106,21 @@
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Resources\Internet.pl-PL.Designer.cs">
<DependentUpon>Internet.pl-PL.resx</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Resources\Name.pl-PL.Designer.cs">
<DependentUpon>Name.pl-PL.resx</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Resources\Phone.pl-PL.Designer.cs">
<DependentUpon>Phone.pl-PL.resx</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Resources\Phone.pt-BR.Designer.cs">
<DependentUpon>Phone.pt-BR.resx</DependentUpon>
<AutoGen>True</AutoGen>
Expand Down Expand Up @@ -149,11 +175,21 @@
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\Address.pl-PL.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Address.pl-PL.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Address.de-DE.resx" />
<EmbeddedResource Include="Resources\Address.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Address.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Company.pl-PL.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Company.pl-PL.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Company.de-DE.resx" />
<EmbeddedResource Include="Resources\Company.resx">
<Generator>ResXFileCodeGenerator</Generator>
Expand All @@ -163,6 +199,20 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Address.pt-BR.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Internet.pl-PL.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Internet.pl-PL.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Name.pl-PL.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Name.pl-PL.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Phone.pl-PL.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Phone.pl-PL.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Phone.pt-BR.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Phone.pt-BR.Designer.cs</LastGenOutput>
Expand All @@ -184,6 +234,7 @@
<EmbeddedResource Include="Resources\Lorem.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Lorem.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Name.de-DE.resx" />
<EmbeddedResource Include="Resources\Name.resx">
Expand Down
11 changes: 10 additions & 1 deletion src/Faker/Resources/Address.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
Loading