Mirage 4.0.86
See the version list below for details.
dotnet add package Mirage --version 4.0.86
NuGet\Install-Package Mirage -Version 4.0.86
<PackageReference Include="Mirage" Version="4.0.86" />
paket add Mirage --version 4.0.86
#r "nuget: Mirage, 4.0.86"
// Install Mirage as a Cake Addin #addin nuget:?package=Mirage&version=4.0.86 // Install Mirage as a Cake Tool #tool nuget:?package=Mirage&version=4.0.86
Mirage
Mirage is an open source library for .Net designed to create random data for POCOs, unit tests, etc. Supports .Net Core as well as full .Net.
Setting Up the Library
Mirage relies on Canister in order to hook itself up. In order for this to work, you must do the following at startup:
var MyServices = new ServiceCollection();
...
MyServices.AddCanisterModules(); // Should be last call in order to find any services that you might have added manually.
// Any services added after this may not be found by the system.
When this is done, Mirage is ready to use.
Basic Usage
The main class of interest is the Random class:
Mirage.Random RandomObj = new Mirage.Random();
This class has a number of helper functions including a generic Next function:
RandomObj.Next<short>();
RandomObj.Next<float>();
RandomObj.Next<TimeSpan>();
You can also Specify a number of items that you want returned:
var MyList = RandomObj.Next<short>(4);
The MyList object would contain four shorts. You can similarly pull a random item from a list:
var Item = RandomObj.Next(MyList);
This would return a random short from the MyList object specified above. Or you can simply shuffle a list into a random order:
MyList = RandomObj.Shuffle(MyList);
There is also a thread safe version of Next that is available:
var RandomValue=RandomObj.ThreadSafeNext();
Lastly you can randomly generate an entire class as needed:
public class RandomTestClass
{
[IntGenerator(-100, 100)]
public int A { get; set; }
[LoremIpsum]
public string B { get; set; }
[FloatGenerator(0, 1)]
public float C { get; set; }
[IntGenerator(1, 100)]
public int D { get; set; }
}
...
var Rand = new Mirage.Random();
var Class = Rand.Next<RandomTestClass>();
This will create an object of the type specified and randomly assign values to the properties based on the attributes placed on them. The system has one for all of the basic types as well as a number of string generators including:
- Company
- Full Address
- City
- Domain name
- Email address
- Phone number
- State abbreviation
- State
- Zip Code
- Street Address
- Female/male first name
- Last name
- Female/Male name
- Female/male prefix
- Name suffix
- Full name generator that is male/female/either
- Lorem Ipsum
- Pattern based
- Regex based
- "Problem" strings
Adding Your Own Generator
You may wish to create your own random generator or replace one that is already in the system. In order to do this simply create a class that implements the IGenerator class. Simply specify in the class what type it generates and the system will either add it to the list of generators or replace the existing one with your own. As long as you either don't specify which modules to load or include your target assembly when calling AddCanisterModules, the system will then pick it up automatically and call it as requested. Similarly if you wish for it to be picked up when generating a class, make sure your class inherits from GeneratorAttributeBase. If it does, the random class generation will pick it up.
Installation
The library is available via Nuget with the package name "Mirage". To install it run the following command in the Package Manager Console:
Install-Package Mirage
Build Process
In order to build the library you will require the following:
- Visual Studio 2017
Other than that, just clone the project and you should be able to load the solution and build without too much effort.
Other Info
The problem strings generator is based off of the Max Woolf's "Big List of Naughty Strings" which is MIT licensed.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- BigBook (>= 5.1.21)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.ValueTuple (>= 4.5.0)
-
net8.0
- BigBook (>= 5.1.21)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.ValueTuple (>= 4.5.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Mirage:
Package | Downloads |
---|---|
Inflatable
Inflatable is a simple ORM. |
|
Mecha.Core
Mecha is a C# library that enables automatic testing of classes with the goal of finding ways to break the code. It provides various testing capabilities such as unit testing, security testing through data fuzzing, checking for concurrency issues, and verifying fault tolerance. With just a single line of code, Mecha can automatically test every method in a class. The library seamlessly integrates with your existing testing framework. |
|
TestFountain
TestFountain is a set of addons/extensions for xUnit.net to help with things like data generation. |
|
sundial.core
Sundial is a profiler library used for both comparison of multiple bits of code and hot spot detection. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
5.0.0 | 356 | 11/24/2024 |
4.1.13 | 5,043 | 9/24/2024 |
4.1.12 | 2,104 | 8/29/2024 |
4.1.11 | 389 | 8/26/2024 |
4.1.10 | 294 | 8/24/2024 |
4.1.9 | 783 | 8/21/2024 |
4.1.8 | 682 | 8/19/2024 |
4.1.7 | 647 | 8/14/2024 |
4.1.6 | 768 | 8/3/2024 |
4.1.5 | 972 | 7/24/2024 |
4.1.4 | 689 | 7/10/2024 |
4.1.3 | 1,441 | 6/27/2024 |
4.1.2 | 312 | 6/25/2024 |
4.1.1 | 671 | 6/21/2024 |
4.1.0 | 237 | 6/21/2024 |
4.0.109 | 347 | 6/19/2024 |
4.0.108 | 361 | 6/18/2024 |
4.0.107 | 584 | 6/13/2024 |
4.0.106 | 321 | 6/13/2024 |
4.0.105 | 947 | 5/30/2024 |
4.0.104 | 344 | 5/30/2024 |
4.0.103 | 1,294 | 5/16/2024 |
4.0.102 | 298 | 5/16/2024 |
4.0.101 | 765 | 5/7/2024 |
4.0.100 | 359 | 5/6/2024 |
4.0.99 | 672 | 5/2/2024 |
4.0.98 | 282 | 5/2/2024 |
4.0.97 | 102 | 5/2/2024 |
4.0.96 | 441 | 4/29/2024 |
4.0.95 | 1,114 | 4/12/2024 |
4.0.94 | 335 | 4/11/2024 |
4.0.93 | 328 | 4/10/2024 |
4.0.92 | 660 | 4/2/2024 |
4.0.91 | 336 | 3/29/2024 |
4.0.90 | 392 | 3/28/2024 |
4.0.89 | 891 | 3/18/2024 |
4.0.88 | 271 | 3/15/2024 |
4.0.87 | 313 | 3/14/2024 |
4.0.86 | 355 | 3/13/2024 |
4.0.85 | 512 | 3/11/2024 |
4.0.84 | 289 | 3/8/2024 |
4.0.83 | 345 | 3/7/2024 |
4.0.82 | 320 | 3/6/2024 |
4.0.81 | 338 | 3/5/2024 |
4.0.80 | 348 | 3/4/2024 |
4.0.79 | 843 | 2/29/2024 |
4.0.78 | 305 | 2/28/2024 |
4.0.77 | 291 | 2/27/2024 |
4.0.76 | 432 | 2/26/2024 |
4.0.75 | 140 | 2/23/2024 |
4.0.74 | 226 | 2/22/2024 |
4.0.73 | 148 | 2/22/2024 |
4.0.72 | 147 | 2/21/2024 |
4.0.71 | 148 | 2/21/2024 |
4.0.70 | 229 | 2/16/2024 |
4.0.69 | 311 | 2/14/2024 |
4.0.68 | 229 | 2/12/2024 |
4.0.67 | 175 | 2/9/2024 |
4.0.66 | 164 | 2/9/2024 |
4.0.65 | 198 | 2/7/2024 |
4.0.64 | 169 | 2/6/2024 |
4.0.63 | 2,075 | 2/5/2024 |
4.0.62 | 671 | 2/1/2024 |
4.0.61 | 144 | 1/31/2024 |
4.0.60 | 1,764 | 1/24/2024 |
4.0.59 | 247 | 1/24/2024 |
4.0.58 | 332 | 1/22/2024 |
4.0.57 | 844 | 1/11/2024 |
4.0.56 | 330 | 1/11/2024 |
4.0.55 | 1,295 | 12/27/2023 |
4.0.54 | 871 | 12/19/2023 |
4.0.53 | 630 | 12/14/2023 |
4.0.52 | 316 | 12/13/2023 |
4.0.51 | 250 | 12/12/2023 |
4.0.50 | 1,520 | 11/23/2023 |
4.0.49 | 384 | 11/21/2023 |
4.0.48 | 246 | 11/20/2023 |
4.0.47 | 284 | 11/17/2023 |
4.0.46 | 606 | 11/16/2023 |
4.0.45 | 299 | 11/15/2023 |
4.0.44 | 646 | 11/8/2023 |
4.0.43 | 269 | 11/7/2023 |
4.0.42 | 258 | 11/6/2023 |
4.0.41 | 316 | 11/4/2023 |
4.0.40 | 617 | 10/31/2023 |
4.0.39 | 286 | 10/30/2023 |
4.0.38 | 335 | 10/27/2023 |
4.0.37 | 297 | 10/26/2023 |
4.0.36 | 331 | 10/25/2023 |
4.0.35 | 738 | 10/12/2023 |
4.0.34 | 168 | 10/11/2023 |
4.0.33 | 774 | 9/25/2023 |
4.0.32 | 440 | 9/20/2023 |
4.0.31 | 289 | 9/19/2023 |
4.0.30 | 308 | 9/18/2023 |
4.0.29 | 510 | 9/14/2023 |
4.0.28 | 292 | 9/13/2023 |
4.0.27 | 321 | 9/12/2023 |
4.0.26 | 349 | 9/11/2023 |
4.0.25 | 136 | 9/11/2023 |
4.0.24 | 644 | 9/8/2023 |
4.0.23 | 335 | 9/7/2023 |
4.0.22 | 358 | 9/6/2023 |
4.0.21 | 388 | 9/4/2023 |
4.0.20 | 374 | 9/2/2023 |
4.0.19 | 151 | 9/1/2023 |
4.0.18 | 427 | 8/31/2023 |
4.0.17 | 572 | 8/29/2023 |
4.0.16 | 395 | 8/29/2023 |
4.0.15 | 603 | 8/24/2023 |
4.0.14 | 363 | 8/24/2023 |
4.0.13 | 347 | 8/22/2023 |
4.0.12 | 532 | 8/18/2023 |
4.0.11 | 1,942 | 8/9/2023 |
4.0.10 | 359 | 8/8/2023 |
4.0.9 | 223 | 8/8/2023 |
4.0.8 | 452 | 8/7/2023 |
4.0.7 | 254 | 8/4/2023 |
4.0.6 | 436 | 8/2/2023 |
4.0.5 | 374 | 7/27/2023 |
4.0.4 | 308 | 7/25/2023 |
4.0.3 | 419 | 7/20/2023 |
4.0.2 | 530 | 7/14/2023 |
4.0.1 | 786 | 12/13/2022 |
4.0.0 | 2,035 | 12/12/2022 |
3.0.19 | 2,865 | 6/10/2022 |
3.0.17 | 869 | 2/17/2022 |
3.0.16 | 481 | 2/3/2022 |
3.0.15 | 2,434 | 1/11/2022 |
3.0.14 | 2,285 | 7/22/2021 |
3.0.13 | 371 | 7/22/2021 |
3.0.11 | 377 | 7/20/2021 |
3.0.10 | 621 | 6/16/2021 |
3.0.9 | 957 | 6/16/2021 |
3.0.8 | 6,941 | 1/6/2021 |
3.0.6 | 2,925 | 9/13/2020 |
3.0.5 | 7,892 | 3/25/2020 |
3.0.4 | 1,618 | 3/18/2020 |
3.0.3 | 571 | 3/17/2020 |
3.0.2 | 579 | 3/17/2020 |
3.0.1 | 1,588 | 3/1/2020 |
3.0.0 | 3,202 | 12/23/2019 |
2.0.12 | 1,511 | 3/12/2019 |
2.0.11 | 667 | 3/12/2019 |
2.0.10 | 1,373 | 2/21/2019 |
2.0.9 | 3,117 | 8/14/2018 |
2.0.8 | 1,595 | 8/10/2018 |
2.0.7 | 925 | 8/9/2018 |
2.0.6 | 948 | 8/9/2018 |
2.0.5 | 980 | 8/9/2018 |
2.0.4 | 1,013 | 8/8/2018 |
2.0.3 | 1,103 | 8/8/2018 |
2.0.2 | 3,485 | 6/1/2018 |
2.0.1 | 1,867 | 5/22/2018 |
2.0.0 | 4,506 | 1/2/2018 |
1.0.10 | 14,293 | 6/13/2017 |
1.0.9 | 1,716 | 5/17/2017 |
1.0.8 | 1,088 | 3/22/2017 |
1.0.7 | 1,094 | 2/21/2017 |
1.0.5 | 1,130 | 2/8/2017 |
1.0.4 | 1,151 | 2/7/2017 |
1.0.3 | 1,162 | 2/6/2017 |
1.0.2 | 1,102 | 1/24/2017 |
1.0.1 | 1,122 | 1/18/2017 |