BT

Your opinion matters! Please fill in the InfoQ Survey!

Use Faker.NET To Fake Your Data

| by Roopesh Shenoy Follow 0 Followers on Apr 03, 2012. Estimated reading time: 1 minute |

A note to our readers: As per your request we have developed a set of features that allow you to reduce the noise, while not losing sight of anything that is important. Get email and web notifications by choosing the topics you are interested in.

Faker is an open source C# port of the Ruby Faker gem mainly used to easily generate fake (but presentable) data – names, addresses, phone numbers, etc. Handy, whether its for demonstration purposes or for creating test data.

How does it work? A look inside the code shows how – the solution contains resource files with possible good values for each of the attributes (for eg. First Name, Last Name, etc) and code randomly mixes and matches these to generate the data. The more the pre-fed values for each of these attributes, the more combinations are possible and hence richer the data. Depending on your specific needs, you might want to modify the resource files to reflect the data you need (for instance, names or addresses localized to a particular region). An article from Ollie Riches shows a quick usage of the library.

The utility is compatible with .NET Framework 4.0, Silverlight 3-5 and Windows Phone 7.0 and 7.1. It is available as a NuGet Package.

There is another GitHub project with the same name (Faker.NET) that seems to work in the same way except for a couple of things – the possible values are directly in the C# code (instead of resource files) and it has an additional class for Education (Degree, Major, School, etc).

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

wow by cowboy cowboy

Also, you can use Bogus for .NET. It's a C# port of faker.js with some syntax sugar. :) github.com/bchavez/Bogus

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

1 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT