{"id":24271903,"url":"https://github.com/soenneker/soenneker.utils.autobogus","last_synced_at":"2026-04-08T15:01:06.521Z","repository":{"id":214562757,"uuid":"736818357","full_name":"soenneker/soenneker.utils.autobogus","owner":"soenneker","description":"The .NET Autogenerator","archived":false,"fork":false,"pushed_at":"2026-03-31T04:37:40.000Z","size":1524,"stargazers_count":70,"open_issues_count":5,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-03-31T04:50:02.460Z","etag":null,"topics":["autobogus","autofaker","bogus","csharp","dotnet","faker","mock","tests","utils"],"latest_commit_sha":null,"homepage":"https://soenneker.com","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/soenneker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"soenneker","thanks_dev":"soenneker"}},"created_at":"2023-12-29T01:07:16.000Z","updated_at":"2026-03-31T04:37:45.000Z","dependencies_parsed_at":"2026-03-14T23:06:32.193Z","dependency_job_id":null,"html_url":"https://github.com/soenneker/soenneker.utils.autobogus","commit_stats":null,"previous_names":["soenneker/soenneker.utils.autobogus"],"tags_count":105,"template":false,"template_full_name":null,"purl":"pkg:github/soenneker/soenneker.utils.autobogus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soenneker%2Fsoenneker.utils.autobogus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soenneker%2Fsoenneker.utils.autobogus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soenneker%2Fsoenneker.utils.autobogus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soenneker%2Fsoenneker.utils.autobogus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soenneker","download_url":"https://codeload.github.com/soenneker/soenneker.utils.autobogus/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soenneker%2Fsoenneker.utils.autobogus/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31560476,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autobogus","autofaker","bogus","csharp","dotnet","faker","mock","tests","utils"],"created_at":"2025-01-15T17:59:57.903Z","updated_at":"2026-04-08T15:01:06.502Z","avatar_url":"https://github.com/soenneker.png","language":"C#","funding_links":["https://github.com/sponsors/soenneker","https://thanks.dev/soenneker"],"categories":[],"sub_categories":[],"readme":"[![](https://img.shields.io/nuget/v/soenneker.utils.autobogus.svg?style=for-the-badge)](https://www.nuget.org/packages/soenneker.utils.autobogus/)\n[![](https://img.shields.io/github/actions/workflow/status/soenneker/soenneker.utils.autobogus/publish-package.yml?style=for-the-badge)](https://github.com/soenneker/soenneker.utils.autobogus/actions/workflows/publish-package.yml)\n[![](https://img.shields.io/nuget/dt/soenneker.utils.autobogus.svg?style=for-the-badge)](https://www.nuget.org/packages/soenneker.utils.autobogus/)\n[![](https://img.shields.io/github/actions/workflow/status/soenneker/soenneker.utils.autobogus/codeql.yml?label=CodeQL\u0026style=for-the-badge)](https://github.com/soenneker/soenneker.utils.autobogus/actions/workflows/codeql.yml)\n\n# ![](https://user-images.githubusercontent.com/4441470/224455560-91ed3ee7-f510-4041-a8d2-3fc093025112.png) Soenneker.Utils.AutoBogus\n### The .NET Autogenerator \n\nThis project is an automatic creator and populator for the fake data generator [Bogus](https://github.com/bchavez/Bogus). It's a replacement for the abandoned [AutoBogus](https://github.com/nickdodd79/AutoBogus) library.\n\nThe goals:\n- Be *fast*\n- Support the latest types in .NET\n\nIt uses the fastest .NET Reflection cache: [soenneker.reflection.cache](https://github.com/soenneker/soenneker.reflection.cache). Bogus updates are automatically integrated.\n\n.NET 8+ is supported.\n\n## Installation\n\n```\ndotnet add package Soenneker.Utils.AutoBogus\n```\n\n## Usage\n\n- Create an `AutoFaker` instance:\n```csharp\nvar optionalConfig = new AutoFakerConfig();\nvar autoFaker = new AutoFaker(optionalConfig);\n```\n\n- Call `Generate\u003c\u003e()` on any type you want:\n\n```csharp\nvar randomWord = autoFaker.Generate\u003cstring\u003e();\nvar dictionary = autoFaker.Generate\u003cDictionary\u003cint, string\u003e\u003e();\nvar order = autoFaker.Generate\u003cOrder\u003e();\n```\n\n- It's also possible to generate types via an argument:\n\n```csharp\nvar randomWord = autoFaker.Generate(typeof(string));\n```\n\n- Set a faker, configuration, rules, etc:\n\n```csharp\nautoFaker.Config.Faker = new Faker(\"de\");\nautoFaker.Config.RepeatCount = 3;\n...\n```\n\n## `AutoFakerOverride`\n\nThis is the recommended way for controlling type customization:\n\n```csharp\npublic class OrderOverride : AutoFakerOverride\u003cOrder\u003e\n{\n    public override void Generate(AutoFakerOverrideContext context)\n    {\n        var target = (context.Instance as Order)!;\n        target.Id = 123;\n        \n        // Faker is available\n        target.Name = context.Faker.Random.Word();\n\n        // AutoFaker is also available\n        target.Customer = context.AutoFaker.Generate\u003cCustomer\u003e();\n     }\n}\n```\n\nThen just add `AutoFakerOverride` to the `AutoFaker.Config` instance:\n\n```csharp\nautoFaker.Config.Overrides = new List\u003cAutoFakerGeneratorOverride\u003e();\nautoFaker.Config.Overrides.Add(new OrderOverride());\n```\n\n## `AutoFaker\u003cT\u003e`\n\nThis inherits from `Bogus.Faker`, and can be used to designate rules specific to the `AutoFaker` instance.\n\n```csharp\nvar autoFaker = new AutoFaker\u003cOrder\u003e();\nautoFaker.RuleFor(x =\u003e x.Id, f =\u003e f.Random.Number());\nvar order = autoFaker.Generate();\n```\n\n## Interfaces/Abstracts\n\nThe base library does not generate interfaces or abstract objects, but these enable you to generate mocks of them:\n\n- [soenneker.utils.autobogus.moq](https://github.com/soenneker/soenneker.utils.autobogus.moq)\n- [soenneker.utils.autobogus.nsubstitute](https://github.com/soenneker/soenneker.utils.autobogus.nsubstitute)\n- [soenneker.utils.autobogus.fakeiteasy](https://github.com/soenneker/soenneker.utils.autobogus.fakeiteasy)\n\n## Tips\n- ?? Instantiating an `AutoFaker` takes a non-trivial amount of time because of Bogus `Faker` initialization (almost 1ms). It's recommended that a single instance be used if possible.\n- `AutoFaker.GenerateStatic\u003cT\u003e()` is also available, but should be avoided (as it creates a new `AutoFaker`/`Faker` on each call).\n\n## Notes\n- Some patterns that existed in AutoBogus have been removed due to the complexity and performance impact.\n- This is a work in progress. Contribution is welcomed.\n\n## Benchmarks\n\n### Soenneker.Utils.AutoBogus - `AutoFaker`\n\n| Method           | Mean        | Error     | StdDev    |\n|----------------- |------------:|----------:|----------:|\n| Generate_int     |    79.40 ns |  0.635 ns |  0.563 ns |\n| Generate_string  |   241.35 ns |  3.553 ns |  3.324 ns |\n| Generate_complex | 6,782.34 ns | 43.811 ns | 38.837 ns |\n\n### Soenneker.Utils.AutoBogus - `AutoFaker\u003cT\u003e`\n\n| Method           | Mean       | Error    | StdDev   |\n|----------------- |-----------:|---------:|---------:|\n| Generate_string  |   283.6 ns |  3.28 ns |  3.07 ns |\n| Generate_complex | 8,504.0 ns | 76.58 ns | 67.89 ns |\n\n### AutoBogus\n\n| Method           | Mean      | Error    | StdDev   |\n|----------------- |----------:|---------:|---------:|\n| Generate_int     |   1.17 ms | 0.033 ms | 0.026 ms |\n| Generate_complex |  10.91 ms | 0.181 ms | 0.236 ms |\n\n### Bogus\n\n| Method       | Mean          | Error        | StdDev       |\n|------------- |--------------:|-------------:|-------------:|\n| Bogus_int    |      19.70 ns |     0.176 ns |     0.165 ns |\n| Bogus_string |     171.75 ns |     2.763 ns |     2.585 ns |\n| Bogus_ctor   | 730,669.06 ns | 8,246.622 ns | 7,310.416 ns |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoenneker%2Fsoenneker.utils.autobogus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoenneker%2Fsoenneker.utils.autobogus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoenneker%2Fsoenneker.utils.autobogus/lists"}