FakeMake 1.0.0

dotnet add package FakeMake --version 1.0.0                
NuGet\Install-Package FakeMake -Version 1.0.0                
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="FakeMake" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FakeMake --version 1.0.0                
#r "nuget: FakeMake, 1.0.0"                
#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 FakeMake as a Cake Addin
#addin nuget:?package=FakeMake&version=1.0.0

// Install FakeMake as a Cake Tool
#tool nuget:?package=FakeMake&version=1.0.0                

FakeMake

One of the easiest ways to create fake objects from different classes. With the ability to set custom settings.

by convention it handles some : email , phone , tell , address , site you can have any config on any properties of class witch will override the default convention config of FakeMake


public class TesTC
{
   public long Id { get; set; }
   public string WebSite { get; set; }
   public string Phone { get; set; }
   public string Address { get; set; }
   public string AAAA { get; set; }
   public string email { get; set; }
   public TesTC2 TesTC2 { get; set; }
}
public class TesTC2
{
   public long Id { get; set; }
   public string WebSite { get; set; }
   public string EMail { get; set; }
   public string Address { get; set; }
   public List<TesTC3> TesTC3 { get; set; }
}
public record TesTC3
{
   public long Id { get; set; }
   public string WebSite { get; private set; }
   public string EMail { get; private set; }
   public List<TesTC4> TesTC4 { get; set; }
}
public record TesTC4
{
   public long id { get; set; }
}

there are two ways to have a fake object of class

 var obj = Fake.Of<TesTC>(Alphabet.Persian);
 ////or
 var obj2 = new TesTC().FakeIt(Alphabet.Persian);
  var obj = Fake.Of<TesTC>(Alphabet.English, x =>
       {
           x.email = "dddd@gmail.com";
           x.Id = new Random().Next(50, 150);
           x.TesTC2.Address = "df asdfa dssdads";
           x.TesTC2.Id = 502000;

           for (int i = 0; i < 3; i++)
               x.TesTC2.TesTC3.Add(Fake.Of<TesTC3>(Alphabet.Persian, x =>
               {
                   for (int j = 0; j < 14; j++)
                       x.TesTC4.Add(Fake.Of<TesTC4>(Alphabet.Persian, y =>
                       {
                           y.id = 100;
                       }));
               }));
           ////or
           x.TesTC2.TesTC3.WithCount(3, Alphabet.Persian, x =>
           {
               x.TesTC4.WithCount(14, Alphabet.Persian, y =>
               {
                   y.id = 100;
               });
           });

       });

or even fake strings such as

 var fakeEmail = Fake.Email();//"cvnbvt@yahoo.com"
 var fakePhone = Fake.Phone();//"8439922449"
 var fakeAddress = Fake.Address(Alphabet.English); //"Iptpjy Dxyjttro Mcyib Tdawfkl Fcudfi NO46 floor 8"
 var fakeWebSite = Fake.WebSite();//"https://uiimymvbs.org"
 var fakeWord = Fake.Word(Alphabet.English); //"Wdxqwctie 
 var fakeSentence = Fake.Sentence(wordCount: 10, Alphabet.English);//"Vcmqtb Prwna Uipcjs Uyyobeejt Juejij Fwsosu Nurkiq Rlznm Jvpaqkwe Smrlvtmvn "
 var fakeSentence2 = Fake.Sentence(wordCountFrom: 4, wordCountTo: 20, Alphabet.English); //"Mqxbuuw Ukvzuqsd Qfjtvei Adofo Foayuqewv Kenvace Crxyaxfu Msval Qiyve Adaipr Otlstmqj Zpjlfucaq Cfdqyme Talmki Mtxdcjqk Vtzse Jiazl Pacvtatw "

To avoid having to do settings like alphabet or ... every time to create a new object, you can use the FakeMaker class.

  var fm = new FakeMaker(new()
  {
      Chars = "abcdefijklmnopqrstuvwxyzäöüßابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهیآ",
      //or
      Alphabet = Alphabet.English,
      CapitalizeFirstLetterOfWord = true,
      EmailProviders = ["redmask.ir"],
      WebSiteProtocol = [".biz", ".gov"],
      WordCountInSentenceFrom = 12,
      WordCountInSentenceTo = 20
  });
  
  
  var fakeEmail = fm.Email();       //"cvnbvt@redmask.ir"
  var fakePhone = fm.Phone();       //"8439922449"
  var fakeAddress = fm.Address();   //"Iptpjy Dxyjttro Mcyib Tdawfkl Fcudfi NO46 floor 8"
  var fakeWebSite = fm.WebSite();   //"https://uiimymvbs.biz"
  var fakeWord = fm.Word();         //"Wdxqwctie 
  var fakeSentence = fm.Sentence(); //"Mqxbuuw Ukvzuqsd Qfjtvei Adofo Foayuqewv Kenvace Crxyaxfu Msval Qiyve Adaipr Otlstmqj Zpjlfucaq Cfdqyme Talmki Mtxdcjqk Vtzse Jiazl Pacvtatw "
  
  var obj2 = fm.Of<TesTC2>(x =>
  {
      x.ListProp = fm.ListOf<TesTC3>(4);
  });
  
  var obj3 = fm.Of<TesTC3>();
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.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.0.0 108 3/13/2025