MockDataGenerator 1.3.1

dotnet add package MockDataGenerator --version 1.3.1                
NuGet\Install-Package MockDataGenerator -Version 1.3.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MockDataGenerator" Version="1.3.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MockDataGenerator --version 1.3.1                
#r "nuget: MockDataGenerator, 1.3.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MockDataGenerator as a Cake Addin
#addin nuget:?package=MockDataGenerator&version=1.3.1

// Install MockDataGenerator as a Cake Tool
#tool nuget:?package=MockDataGenerator&version=1.3.1                

MockDataGenerator

Generate mock data for POCO

NuGet Nuget AppVeyor AppVeyor tests


namespace XUnitTestProject1
{
    public class MockGeneratorTests
    {
        [Fact]
        public void Test()
        {
            var productGenerator = new MockDataGenerator<Product>()
                .Register(x => x.Name, x => x.Name())
                .Register(x => x.Explanation, x => x.LoremIpsum())
                .Register(x => x.Category, x => x.Object(
                    new MockDataGenerator<Category>()
                        .Register(cat => cat.Id, cat => cat.AutoIncrement())
                        .Register(cat => cat.Name, cat => cat.Random())
                 ))
                .Register(x => x.CategoryId, model => model.Category.Id)
                .Register(x => x.Comments, x => x.List())
                .Register(x => x.Price, x => x.Random())
                .Register(x => x.Unit, x => x.Random(5, 15))
                .Register(x => x.Amount, (model) => model.Price * model.Unit)
                .Register(x => x.Id, x => x.Guid())
                .Register(x => x.Barcodes, x => x.Array())
                .Register(x => x.CurrencySymbol, x => x.CurrencySymbol())
                .Register(x => x.Hash, x => x.MD5())
                .Register(x => x.Size, x => x.FromEnum())
                .Register(x => x.Sales, x => x.List(
                      new MockDataGenerator<Sales>()
                              .Register(sale => sale.CardNumber, sale => sale.CreditCard())
                              .Register(sale => sale.Iban, sale => sale.IBAN())
                              .Register(sale => sale.SaleDate, sale => sale.Random())
                              .Register(sale => sale.Customer, sale => sale.Object(
                                  new MockDataGenerator<Customer>()
                                        .Register(cust => cust.Email, cust => cust.Email())
                                        .Register(cust => cust.Gender, cust => cust.Gender())
                                        .Register(cust => cust.Id, cust => cust.Guid())
                                        .Register(cust => cust.Name, cust => cust.Name())
                                        .Register(cust => cust.PersonalPage, cust => cust.Url(true))
                                        .Register(cust => cust.Phone, cust => cust.Phone())
                                        .Register(cust => cust.Region, cust => cust.Region())
                                        .Register(cust => cust.Surname, cust => cust.Surname())
                              ))
                      ));


            var data = productGenerator.Generate(5);
        }
    }

    public class Customer
    {
        public Guid Id { get; set; }

        public string Name { get; set; }

        public string Surname { get; set; }

        public string Phone { get; set; }

        public string Email { get; set; }

        public string PersonalPage { get; set; }

        public string Region { get; set; }

        public string Gender { get; set; }
    }

    public class Sales
    {
        public DateTime SaleDate { get; set; }

        public Customer Customer { get; set; }

        public string Iban { get; set; }

        public string CardNumber { get; set; }
    }

    public class Category
    {
        public int Id { get; set; }
        public string Name { get; set; }
    }

    public class Product
    {
        public Guid Id { get; set; }

        public string Name { get; set; }

        public string Explanation { get; set; }

        public decimal Price { get; set; }

        public int Unit { get; set; }

        public decimal Amount { get; set; }

        public int CategoryId { get; set; }
        public Category Category { get; set; }

        public string[] Barcodes { get; set; }

        public List<Sales> Sales { get; set; }

        public List<Guid> Comments { get; set; }

        public string Hash { get; set; }

        public string CurrencySymbol { get; set; }

        public SizeCategory Size { get; set; }
    }

    public enum SizeCategory
    {
        Small,
        Medium,
        Large
    }
}

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net35 is compatible.  net40 is compatible.  net403 was computed.  net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.1

    • No dependencies.
  • .NETFramework 3.5

    • No dependencies.
  • .NETFramework 4.0

    • No dependencies.
  • .NETFramework 4.5

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • net5.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.1 2,605 12/24/2021
1.3.0 5,500 2/9/2020
1.2.1 646 2/3/2020
1.1.7 526 1/20/2020
1.1.6 476 1/19/2020
1.1.4 625 1/19/2020 1.1.4 is deprecated because it has critical bugs.
1.0.2 528 11/5/2019
1.0.1 461 11/5/2019
1.0.0 469 11/5/2019

Make Multitarget