{"id":13431790,"url":"https://github.com/MisterJames/GenFu","last_synced_at":"2025-03-16T22:32:23.673Z","repository":{"id":5819082,"uuid":"7034320","full_name":"MisterJames/GenFu","owner":"MisterJames","description":"GenFu is a library you can use to generate realistic test data. It is composed of several property fillers that can populate commonly named properties through reflection using an internal database of values or randomly created data. You can override any of the fillers, give GenFu hints on how to fill them.","archived":false,"fork":false,"pushed_at":"2022-11-30T11:56:41.000Z","size":15234,"stargazers_count":832,"open_issues_count":49,"forks_count":101,"subscribers_count":32,"default_branch":"master","last_synced_at":"2024-10-04T12:05:43.242Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MisterJames.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-12-06T11:08:21.000Z","updated_at":"2024-09-10T00:04:49.000Z","dependencies_parsed_at":"2023-01-13T13:42:47.965Z","dependency_job_id":null,"html_url":"https://github.com/MisterJames/GenFu","commit_stats":null,"previous_names":["misterjames/angelasmith"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MisterJames%2FGenFu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MisterJames%2FGenFu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MisterJames%2FGenFu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MisterJames%2FGenFu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MisterJames","download_url":"https://codeload.github.com/MisterJames/GenFu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221668938,"owners_count":16860763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-07-31T02:01:05.918Z","updated_at":"2025-03-16T22:32:23.669Z","avatar_url":"https://github.com/MisterJames.png","language":"C#","readme":"GenFu \n===========\n\nhttp://genfu.io/ \n\n![Build status](https://github.com/MisterJames/GenFu/workflows/Continuous%20Integration/badge.svg) [![NuGet Badge](https://buildstats.info/nuget/GenFu)](https://www.nuget.org/packages/GenFu/)\n\n\u003e **GenFu** is a library you can use to generate realistic test data. It is composed of several *property fillers* that can populate commonly named properties through reflection using an internal database of values or randomly created data. You can override any of the fillers, give **GenFu** hints on how to fill them.\n\nGenFu is all about _smartly_ building up objects to use for test and prototype data. It will walk your object graph and fill in the properties on your type with realistic looking data.  \n\nUse GenFu's static methods to new up new objects for testing, design-time data or seeding a database. \n\n**GenFu** runs on AspNetCore50 and can run anywhere core can run.\n\nInstallation\n===========\nGenFu is on [NuGet](https://nuget.org/packages/GenFu) so you can easily add it to your project from the Package Manager Console:\n\n```   \ninstall-package GenFu \n```\n\n\nExample Usage\n===========\nLet's say you have a Person class like so:\n\n```\n    class Person\n    {\n        public string FirstName { get; set; }\n        public string LastName { get; set; }\n        public string Title { get; set; }\n        public int Age { get; set; }\n        public int NumberOfKids { get; set; }\n\t\t\n\t\tprivate string _middleName;\n\t\tpublic void SetMiddleName(string name){ _middleName = name; }\n    }\n```\n\nAnd you want a new instance of Person.  With GenFu, you just do this:\n\n```\n    var person = A.New\u003cPerson\u003e();\n```\n\nTada!  Your `person` is now filled with all the data you could ever dream of!\n\n## But Wait!\n\n\u003e\"I don't need no stickin' person! I need a whole list of them! \n\nEasy-peasy lemon squeezy, my friend!  Ask for a list instead of a single instance like so:\n\n```\n    var people = A.ListOf\u003cPerson\u003e();\n```\n\nThere...you have 25 people, this is the default in a list.\n\n\u003e\"Yeah, sure, fine, but they have to be between the ages of 19 and 25!\" \n\nCool beans, my brother or sister.  Here's how GenFu rolls:\n\n```\n\n    GenFu.Configure\u003cPerson\u003e()\n        .Fill(p =\u003e p.Age)\n        .WithinRange(19, 25);\n    var people = A.ListOf\u003cPerson\u003e();\n\n```\n\nAnd you're off to the races!  Don't worry, I won't tell your boss how long that took.  ;)\n\nCustom Property Fillers\n===========\n\nIf you want to control how the property is set, you can use your own function (anonymous or otherwise) to do so.\n\n```\n    var blogTitle = \"GenFu\";\n\n    GenFu.Configure\u003cBlogPost\u003e()\n        .Fill(b =\u003e b.Title, () =\u003e { return blogTitle; })\n    \n    var post = A.New\u003cBlogPost\u003e();\n```\n\n\nMethod Fillers\n===========\n\nIf your project uses one-parameter setter methods, you can use GenFu too!\n\n```\n    GenFu.Configure\u003cPerson\u003e()\n        .MethodFill\u003cstring\u003e(x =\u003e x.SetMiddleName(null))\n    var post = A.New\u003cPerson\u003e();\n```\n\nYou can use any of the helper methods with setter methods, just like with properties.\n\n**Note**: **Unlike** properties, GenFu will not automatically poke data into any methods found. That sounds a little too risky! So if you want GenFu to use your setter methods, specify each method you'd like filled.\n\nMore To Come\n===========\n**GenFu** was originally created by James Chambers, David Paquette and Simon Timms under the name **AngelaSmith**.  \n\nWe are continuing to add more features, such as:\n - Better support for object self-awareness (think of an email address lining up with a first name/last name or username)\n - Additional property fillers\n","funding_links":[],"categories":["Frameworks, Libraries and Tools","C# #","框架, 库和工具","Testing"],"sub_categories":["Testing","测试"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMisterJames%2FGenFu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMisterJames%2FGenFu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMisterJames%2FGenFu/lists"}