{"id":15101864,"url":"https://github.com/owen-krueger/autofixture.community.customizations","last_synced_at":"2026-01-26T11:34:32.767Z","repository":{"id":244085709,"uuid":"814219121","full_name":"Owen-Krueger/AutoFixture.Community.Customizations","owner":"Owen-Krueger","description":"Useful customizations for AutoFixture","archived":false,"fork":false,"pushed_at":"2024-11-04T09:11:32.000Z","size":31,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T15:26:40.491Z","etag":null,"topics":["autofixture","csharp","dateonly","net6","net7","net8","nuget","timeonly","unit-testing"],"latest_commit_sha":null,"homepage":"","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/Owen-Krueger.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-12T15:08:11.000Z","updated_at":"2024-06-18T16:34:52.000Z","dependencies_parsed_at":"2024-06-12T21:44:13.423Z","dependency_job_id":null,"html_url":"https://github.com/Owen-Krueger/AutoFixture.Community.Customizations","commit_stats":null,"previous_names":["owen-krueger/autofixture.customizations","owen-krueger/autofixture.communty.customizations"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Owen-Krueger%2FAutoFixture.Community.Customizations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Owen-Krueger%2FAutoFixture.Community.Customizations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Owen-Krueger%2FAutoFixture.Community.Customizations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Owen-Krueger%2FAutoFixture.Community.Customizations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Owen-Krueger","download_url":"https://codeload.github.com/Owen-Krueger/AutoFixture.Community.Customizations/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237743729,"owners_count":19359287,"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":["autofixture","csharp","dateonly","net6","net7","net8","nuget","timeonly","unit-testing"],"created_at":"2024-09-25T18:42:10.316Z","updated_at":"2025-10-22T22:31:09.887Z","avatar_url":"https://github.com/Owen-Krueger.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AutoFixture Community Customizations\n\n[![.NET](https://github.com/Owen-Krueger/AutoFixture.Community.Customizations/actions/workflows/dotnet.yaml/badge.svg)](https://github.com/Owen-Krueger/AutoFixture.Community.Customizations/actions/workflows/dotnet.yaml)\n\n## IgnoreAutoFixture Attribute\n\nThe `IgnoreAutoFixture` attribute can be added to properties in a model to instruct AutoFixture to ignore/omit the property during building, unless explicitly instructed to be created.\n\nThis is especially useful for standing up models used by Entity Framework. Most of these models utilize circular dependencies, which would cause an exception to be raised by AutoFixture normally.\n\nAn example of this can be found below:\n\n``` C#\npublic class TestModel\n{\n    public InnerModel? IncludedModel { get; set; } // Will be instantiated by AutoFixture\n\n    [IgnoreAutoFixture]\n    public InnerModel? OmittedModel { get; set; } // Will be omitted by AutoFixture\n    \n    [IgnoreAutoFixture]\n    public InnerModel? ExplicitlyIncludedModel { get; set; } // Will also be omitted by AutoFixture, but will be explicitly included (see below)\n}\n\npublic class Tests\n{\n    [Test]\n    public void AutoFixtureTests()\n    {\n        var fixture = new Fixture();\n        fixture.AddIgnorePropertiesCustomization();\n        \n        var model = fixture.Build\u003cTestModel\u003e()\n            .With(x =\u003e x.ExplicitlyIncludedModel, new InnerModel()) // Tells AutoFixture to set this property, instead of ignoring it.\n            .Create();\n        \n        Assert.That(model.IncludedModel, Is.Not.Null);\n        Assert.That(model.OmittedModel, Is.Null);\n        Assert.That(model.ExplicitlyIncludedModel, Is.Not.Null);\n    }\n}\n```\n\n## DateOnly/TimeOnly Customization\n\nAutoFixture customizations are provided to handle `DateOnly` and `TimeOnly` properties. By default, AutoFixture doesn't handle these types and will throw exceptions.\n\nAn example of this can be found below:\n\n``` C#\npublic class TestModel\n{\n    public DateOnly? Date { get; set; }\n\n    public TimeOnly? Time { get; set; }\n    \n}\n\npublic class Tests\n{\n    [Test]\n    public void AutoFixtureTests()\n    {\n        var fixture = new Fixture();\n        fixture\n            .AddDateOnlyCustomization()\n            .AddTimeOnlyCustomization();\n        \n        var model = fixture.Create\u003cTestModel\u003e();\n        \n        Assert.That(model.Date, Is.Not.Null);\n        Assert.That(model.Time, Is.Not.Null);\n    }\n}\n```\n\n## AutoFixture Extension Methods\n\nTo use any of these customizations, you can use the following extension methods:\n\n``` C#\nvar fixture = new Fixture();\nfixture.AddIgnorePropertiesCustomization(); // Ignore properties\nfixture.AddDateOnlyCustomization(); // DateOnly\nfixture.AddTimeOnlyCustomization(); // TimeOnly\n```\n\nYou can also chain any of these extensions together:\n\n``` C#\nvar fixture = new Fixture();\nfixture\n    .AddIgnorePropertiesCustomization()\n    .AddDateOnlyCustomization()\n    .AddTimeOnlyCustomization();\n```\n\n\nIf you'd rather, you can ignore these extension methods and add the customizations yourself manually:\n\n``` C#\nvar fixture = new Fixture();\nfixture.Customizations.Add(new IgnorePropertiesSpecimenBuilder()); // Ignore properties\nfixture.Customize(new DateOnlyCustomization()); // DateOnly\nfixture.Customize(new TimeOnlyCustomization()); // TimeOnly\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowen-krueger%2Fautofixture.community.customizations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fowen-krueger%2Fautofixture.community.customizations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowen-krueger%2Fautofixture.community.customizations/lists"}