https://github.com/anuviswan/mockcollection
Randomize.Net - Generate Random Instances/Collections of any type <T>
https://github.com/anuviswan/mockcollection
Last synced: about 1 year ago
JSON representation
Randomize.Net - Generate Random Instances/Collections of any type <T>
- Host: GitHub
- URL: https://github.com/anuviswan/mockcollection
- Owner: anuviswan
- Created: 2018-12-14T18:16:30.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-17T08:04:39.000Z (almost 7 years ago)
- Last Synced: 2025-03-12T00:41:19.778Z (over 1 year ago)
- Language: C#
- Homepage:
- Size: 53.7 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
**Randomize.Net**
Randomize.Net provides an easy and lightweight extensions for **System.Random** for creating random instances of any type, with generated random value. The whole idea behind Randomize.Net is extend the much familiar System.Random syntax for generating random collections rather than reinventing the wheel with a new syntax.
For Example,
```csharp
var _random = new Random();_
var randomString = _random.GenerateInstance();
var randomInt32 = _random.GenerateInstance();
```
Randomize.Net works with User Defined Types as well, including nested User Defined Types.
```csharp
public class SampleClass
{
public string StringProperty{get;set;}
public int Int32Property {get;set;}
public char CharProperty {get;set;}
}
public class AnotherSampleClass
{
public SampleClass SampleClassProperty{get;set;}
public string StringProperty{get;set;}
}
var sampleClass = _random.GenerateInstance();
var anotherSampleClass = _random.GenerateInstance();
```
*Randomize.Net* also supports generation of Collections.
```csharp
// Method Signature
public static IEnumerable GenerateCollection(this Random source,int count = 1)
//Example
var sampleClassCollection = _random.GenerateCollection(10);
```