Mirage 4.0.33
See the version list below for details.
dotnet add package Mirage --version 4.0.33
NuGet\Install-Package Mirage -Version 4.0.33
<PackageReference Include="Mirage" Version="4.0.33" />
paket add Mirage --version 4.0.33
#r "nuget: Mirage, 4.0.33"
// Install Mirage as a Cake Addin #addin nuget:?package=Mirage&version=4.0.33 // Install Mirage as a Cake Tool #tool nuget:?package=Mirage&version=4.0.33
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 was computed. 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.0.27)
- 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 | 0 | 11/24/2024 |
4.1.13 | 4,898 | 9/24/2024 |
4.1.12 | 2,100 | 8/29/2024 |
4.1.11 | 389 | 8/26/2024 |
4.1.10 | 293 | 8/24/2024 |
4.1.9 | 783 | 8/21/2024 |
4.1.8 | 678 | 8/19/2024 |
4.1.7 | 646 | 8/14/2024 |
4.1.6 | 767 | 8/3/2024 |
4.1.5 | 971 | 7/24/2024 |
4.1.4 | 688 | 7/10/2024 |
4.1.3 | 1,440 | 6/27/2024 |
4.1.2 | 311 | 6/25/2024 |
4.1.1 | 670 | 6/21/2024 |
4.1.0 | 236 | 6/21/2024 |
4.0.109 | 346 | 6/19/2024 |
4.0.108 | 360 | 6/18/2024 |
4.0.107 | 583 | 6/13/2024 |
4.0.106 | 320 | 6/13/2024 |
4.0.105 | 946 | 5/30/2024 |
4.0.104 | 343 | 5/30/2024 |
4.0.103 | 1,293 | 5/16/2024 |
4.0.102 | 297 | 5/16/2024 |
4.0.101 | 764 | 5/7/2024 |
4.0.100 | 358 | 5/6/2024 |
4.0.99 | 671 | 5/2/2024 |
4.0.98 | 281 | 5/2/2024 |
4.0.97 | 101 | 5/2/2024 |
4.0.96 | 440 | 4/29/2024 |
4.0.95 | 1,114 | 4/12/2024 |
4.0.94 | 334 | 4/11/2024 |
4.0.93 | 327 | 4/10/2024 |
4.0.92 | 660 | 4/2/2024 |
4.0.91 | 335 | 3/29/2024 |
4.0.90 | 392 | 3/28/2024 |
4.0.89 | 890 | 3/18/2024 |
4.0.88 | 271 | 3/15/2024 |
4.0.87 | 312 | 3/14/2024 |
4.0.86 | 354 | 3/13/2024 |
4.0.85 | 511 | 3/11/2024 |
4.0.84 | 288 | 3/8/2024 |
4.0.83 | 344 | 3/7/2024 |
4.0.82 | 319 | 3/6/2024 |
4.0.81 | 337 | 3/5/2024 |
4.0.80 | 347 | 3/4/2024 |
4.0.79 | 842 | 2/29/2024 |
4.0.78 | 305 | 2/28/2024 |
4.0.77 | 290 | 2/27/2024 |
4.0.76 | 431 | 2/26/2024 |
4.0.75 | 139 | 2/23/2024 |
4.0.74 | 225 | 2/22/2024 |
4.0.73 | 147 | 2/22/2024 |
4.0.72 | 146 | 2/21/2024 |
4.0.71 | 147 | 2/21/2024 |
4.0.70 | 228 | 2/16/2024 |
4.0.69 | 310 | 2/14/2024 |
4.0.68 | 228 | 2/12/2024 |
4.0.67 | 175 | 2/9/2024 |
4.0.66 | 163 | 2/9/2024 |
4.0.65 | 197 | 2/7/2024 |
4.0.64 | 168 | 2/6/2024 |
4.0.63 | 2,074 | 2/5/2024 |
4.0.62 | 670 | 2/1/2024 |
4.0.61 | 143 | 1/31/2024 |
4.0.60 | 1,763 | 1/24/2024 |
4.0.59 | 246 | 1/24/2024 |
4.0.58 | 331 | 1/22/2024 |
4.0.57 | 843 | 1/11/2024 |
4.0.56 | 329 | 1/11/2024 |
4.0.55 | 1,294 | 12/27/2023 |
4.0.54 | 870 | 12/19/2023 |
4.0.53 | 630 | 12/14/2023 |
4.0.52 | 315 | 12/13/2023 |
4.0.51 | 249 | 12/12/2023 |
4.0.50 | 1,519 | 11/23/2023 |
4.0.49 | 383 | 11/21/2023 |
4.0.48 | 245 | 11/20/2023 |
4.0.47 | 283 | 11/17/2023 |
4.0.46 | 599 | 11/16/2023 |
4.0.45 | 298 | 11/15/2023 |
4.0.44 | 645 | 11/8/2023 |
4.0.43 | 268 | 11/7/2023 |
4.0.42 | 257 | 11/6/2023 |
4.0.41 | 315 | 11/4/2023 |
4.0.40 | 617 | 10/31/2023 |
4.0.39 | 286 | 10/30/2023 |
4.0.38 | 334 | 10/27/2023 |
4.0.37 | 296 | 10/26/2023 |
4.0.36 | 330 | 10/25/2023 |
4.0.35 | 737 | 10/12/2023 |
4.0.34 | 167 | 10/11/2023 |
4.0.33 | 774 | 9/25/2023 |
4.0.32 | 440 | 9/20/2023 |
4.0.31 | 288 | 9/19/2023 |
4.0.30 | 307 | 9/18/2023 |
4.0.29 | 509 | 9/14/2023 |
4.0.28 | 291 | 9/13/2023 |
4.0.27 | 320 | 9/12/2023 |
4.0.26 | 348 | 9/11/2023 |
4.0.25 | 135 | 9/11/2023 |
4.0.24 | 643 | 9/8/2023 |
4.0.23 | 334 | 9/7/2023 |
4.0.22 | 357 | 9/6/2023 |
4.0.21 | 387 | 9/4/2023 |
4.0.20 | 373 | 9/2/2023 |
4.0.19 | 150 | 9/1/2023 |
4.0.18 | 426 | 8/31/2023 |
4.0.17 | 571 | 8/29/2023 |
4.0.16 | 394 | 8/29/2023 |
4.0.15 | 602 | 8/24/2023 |
4.0.14 | 362 | 8/24/2023 |
4.0.13 | 346 | 8/22/2023 |
4.0.12 | 531 | 8/18/2023 |
4.0.11 | 1,937 | 8/9/2023 |
4.0.10 | 358 | 8/8/2023 |
4.0.9 | 222 | 8/8/2023 |
4.0.8 | 452 | 8/7/2023 |
4.0.7 | 253 | 8/4/2023 |
4.0.6 | 435 | 8/2/2023 |
4.0.5 | 373 | 7/27/2023 |
4.0.4 | 307 | 7/25/2023 |
4.0.3 | 418 | 7/20/2023 |
4.0.2 | 529 | 7/14/2023 |
4.0.1 | 785 | 12/13/2022 |
4.0.0 | 2,034 | 12/12/2022 |
3.0.19 | 2,862 | 6/10/2022 |
3.0.17 | 868 | 2/17/2022 |
3.0.16 | 481 | 2/3/2022 |
3.0.15 | 2,433 | 1/11/2022 |
3.0.14 | 2,284 | 7/22/2021 |
3.0.13 | 370 | 7/22/2021 |
3.0.11 | 376 | 7/20/2021 |
3.0.10 | 620 | 6/16/2021 |
3.0.9 | 956 | 6/16/2021 |
3.0.8 | 6,940 | 1/6/2021 |
3.0.6 | 2,924 | 9/13/2020 |
3.0.5 | 7,891 | 3/25/2020 |
3.0.4 | 1,617 | 3/18/2020 |
3.0.3 | 570 | 3/17/2020 |
3.0.2 | 578 | 3/17/2020 |
3.0.1 | 1,587 | 3/1/2020 |
3.0.0 | 3,201 | 12/23/2019 |
2.0.12 | 1,510 | 3/12/2019 |
2.0.11 | 666 | 3/12/2019 |
2.0.10 | 1,372 | 2/21/2019 |
2.0.9 | 3,116 | 8/14/2018 |
2.0.8 | 1,594 | 8/10/2018 |
2.0.7 | 922 | 8/9/2018 |
2.0.6 | 947 | 8/9/2018 |
2.0.5 | 979 | 8/9/2018 |
2.0.4 | 1,013 | 8/8/2018 |
2.0.3 | 1,103 | 8/8/2018 |
2.0.2 | 3,484 | 6/1/2018 |
2.0.1 | 1,866 | 5/22/2018 |
2.0.0 | 4,505 | 1/2/2018 |
1.0.10 | 14,292 | 6/13/2017 |
1.0.9 | 1,715 | 5/17/2017 |
1.0.8 | 1,087 | 3/22/2017 |
1.0.7 | 1,093 | 2/21/2017 |
1.0.5 | 1,129 | 2/8/2017 |
1.0.4 | 1,151 | 2/7/2017 |
1.0.3 | 1,161 | 2/6/2017 |
1.0.2 | 1,101 | 1/24/2017 |
1.0.1 | 1,121 | 1/18/2017 |