GithubHelp home page GithubHelp logo

sf-billops / mockaroo.net Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ackara/mockaroo.net

0.0 2.0 0.0 377 KB

Mockaroo.NET is a portable class library that allows you to generate sample data based on a object type using the Mockaroo API.

License: MIT License

PowerShell 2.63% C# 92.37% Smalltalk 5.00%

mockaroo.net's Introduction

Mockaroo.NET

license version

Master Development
Build Status: master development

Mockaroo.NET is a portable class library that allows you to generate sample data based on C# objects using the Mockaroo REST API.

How it works

Lets say you have the following class.

public class Employee
{
	public int Id { get; set; }
	public string Name { get; set; }
	public string Phone { get; set; } 
}

Now you want to generate a collection Employee objects to do some testing. All you have to do is.

var client = new MockarooClient(your_api_key);
IEnumerable<Employee> data = await client.FetchDataAsync<Employee>(records: 100);

This will examine the Employee class properties, then generate random sample objects using the data fetched from the Mockaroo Rest API. The data returned will look something like the following.

[{
	"Id": "156",
	"Name": "aliquam erat volutpat in congue etiam",
	"Phone": "adipiscing molestie hendrerit at vulputate"
}]

If Lorem Ipsum text is not to your liking, you can fine-tune the data returned using the following.

var schema = new Schema<Employee>();
schema.Assign(x=> x.Name, DataType.FullName);
schema.Assign(x=> x.Phone, new PhoneField() { BlankPercentage = 50 });

var client = new MockarooClient(your_api_key);
IEnumerable<Employee> data = await client.FetchDataAsync<Employee>(schema, records: 1000);

The results will look like the following.

[{
	"Id": "156",
	"Name": "John Doe",
	"Phone": "(340) 123-4567"
}]

Currently there are over 85+ data types to choose from, check out the Mockaroo documentation to see the full list. You can also try it at https://www.mockaroo.com/

Available on NuGet

version license

PM> Install-Package Gigobyte.Mockaroo.Core

Contributing

Prequistes:

Note:

Copyright and License

Mockaroo.NET is Copyright © 2015 Ackara and other contributors under the MIT License.

mockaroo.net's People

Contributors

ackara avatar bjoernhund avatar

Watchers

James Cloos avatar Shari Billops avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.