diff --git a/.editorconfig b/.editorconfig
index 69ef33e..d627e2a 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,16 +1,18 @@
root = true
-[*.{cs,fs,fsx}]
-indent_size = 4
-indent_style = space
-
[*.{sln,csproj,fsproj,config,xml,props}]
indent_size = 2
indent_style = space
[*.cs]
+indent_size = 4
+indent_style = space
+
# Require "this." keyword qualification in code
dotnet_style_qualification_for_field = true:suggestion
dotnet_style_qualification_for_property = true:suggestion
dotnet_style_qualification_for_method = true:suggestion
dotnet_style_qualification_for_event = true:suggestion
+
+dotnet_diagnostic.CA1510.severity = suggestion
+dotnet_diagnostic.CA1859.severity = suggestion
diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json
index 75d776d..ec3e4c8 100644
--- a/.nuke/build.schema.json
+++ b/.nuke/build.schema.json
@@ -130,7 +130,7 @@
},
"Solution": {
"type": "string",
- "description": "Path to a solution file that is automatically loaded"
+ "description": "Path to a solution file that is automatically loaded. Default is AutoFixture.TUnit.sln"
}
}
},
diff --git a/AutoFixture.Tests.globalconfig b/AutoFixture.TUnit.Tests.globalconfig
similarity index 100%
rename from AutoFixture.Tests.globalconfig
rename to AutoFixture.TUnit.Tests.globalconfig
diff --git a/AutoFixture.globalconfig b/AutoFixture.TUnit.globalconfig
similarity index 95%
rename from AutoFixture.globalconfig
rename to AutoFixture.TUnit.globalconfig
index 297b7df..3f911a7 100644
--- a/AutoFixture.globalconfig
+++ b/AutoFixture.TUnit.globalconfig
@@ -26,6 +26,7 @@ dotnet_diagnostic.CA5394.severity = none # CA5394: Do not use insecure randomnes
## StyleCop Analyzers ##
+dotnet_diagnostic.SA1101.severity = none # SA1101: Prefix local calls with this.
dotnet_diagnostic.SA1116.severity = none # SA1116: The parameters should begin on the line after the declaration, whenever the parameter span across multiple line
dotnet_diagnostic.SA1117.severity = none # SA1117: The parameters should all be placed on the same line or each parameter should be placed on its own line.
dotnet_diagnostic.SA1118.severity = none # SA1118: The parameter spans multiple lines
@@ -35,6 +36,7 @@ dotnet_diagnostic.SA1202.severity = none # SA1202: 'public' members should come
dotnet_diagnostic.SA1203.severity = none # SA1203: Constant fields should appear before non-constant fields
dotnet_diagnostic.SA1204.severity = none # SA1204: Static members should appear before non-static members
dotnet_diagnostic.SA1214.severity = none # SA1214: Readonly fields should appear before non-readonly fields
+dotnet_diagnostic.SA1309.severity = none # SA1309: Field names should not begin with an underscore
dotnet_diagnostic.SA1413.severity = none # SA1413: Use trailing comma in multi-line initializers
dotnet_diagnostic.SA1501.severity = none # SA1501: Statement should not be on a single line
dotnet_diagnostic.SA1503.severity = none # SA1503: Braces should not be omitted
diff --git a/AutoFixture.TUnit.sln b/AutoFixture.TUnit.sln
index 92436f4..1d4c05c 100644
--- a/AutoFixture.TUnit.sln
+++ b/AutoFixture.TUnit.sln
@@ -17,8 +17,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Common.props = Common.props
Common.Test.props = Common.Test.props
LICENCE.txt = LICENCE.txt
+ AutoFixture.TUnit.globalconfig = AutoFixture.TUnit.globalconfig
+ AutoFixture.TUnit.sln.DotSettings = AutoFixture.TUnit.sln.DotSettings
+ AutoFixture.TUnit.Tests.globalconfig = AutoFixture.TUnit.Tests.globalconfig
EndProjectSection
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestTypeFoundation", "tests\TestTypeFoundation\TestTypeFoundation.csproj", "{5F812210-5B61-4CBF-A033-4C33067A5DE9}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -41,6 +46,12 @@ Global
{4056BD12-5FA8-4D2E-274A-7E85E858A5FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4056BD12-5FA8-4D2E-274A-7E85E858A5FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4056BD12-5FA8-4D2E-274A-7E85E858A5FC}.Verify|Any CPU.ActiveCfg = Verify|Any CPU
+ {5F812210-5B61-4CBF-A033-4C33067A5DE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5F812210-5B61-4CBF-A033-4C33067A5DE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5F812210-5B61-4CBF-A033-4C33067A5DE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5F812210-5B61-4CBF-A033-4C33067A5DE9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5F812210-5B61-4CBF-A033-4C33067A5DE9}.Verify|Any CPU.ActiveCfg = Verify|Any CPU
+ {5F812210-5B61-4CBF-A033-4C33067A5DE9}.Verify|Any CPU.Build.0 = Verify|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/AutoFixture.sln.DotSettings b/AutoFixture.TUnit.sln.DotSettings
similarity index 100%
rename from AutoFixture.sln.DotSettings
rename to AutoFixture.TUnit.sln.DotSettings
diff --git a/Common.Test.props b/Common.Test.props
index cba4f60..3dd7f43 100644
--- a/Common.Test.props
+++ b/Common.Test.props
@@ -34,6 +34,6 @@
-
+
diff --git a/Common.props b/Common.props
index 9b95ccc..7b011a9 100644
--- a/Common.props
+++ b/Common.props
@@ -38,7 +38,7 @@
-
+
diff --git a/build/.editorconfig b/build/.editorconfig
index 31e43dc..8cddf83 100644
--- a/build/.editorconfig
+++ b/build/.editorconfig
@@ -9,3 +9,5 @@ csharp_style_expression_bodied_methods = true:silent
csharp_style_expression_bodied_properties = true:warning
csharp_style_expression_bodied_indexers = true:warning
csharp_style_expression_bodied_accessors = true:warning
+
+dotnet_naming_style.field_style.capitalization = pascal_case
\ No newline at end of file
diff --git a/build/Build.cs b/build/Build.cs
index 763f543..e209985 100644
--- a/build/Build.cs
+++ b/build/Build.cs
@@ -20,20 +20,20 @@
"continuous",
GitHubActionsImage.WindowsLatest,
AutoGenerate = false,
- OnPullRequestBranches = new[] { MasterBranch, ReleaseBranch },
+ OnPullRequestBranches = [MasterBranch, ReleaseBranch],
PublishArtifacts = false,
- InvokedTargets = new[] { nameof(Verify), nameof(Cover), nameof(Pack) },
+ InvokedTargets = [nameof(Verify), nameof(Cover), nameof(Pack)],
EnableGitHubToken = true)]
[GitHubActions(
"release",
GitHubActionsImage.WindowsLatest,
AutoGenerate = false,
- OnPushTags = new[] { "v*" },
+ OnPushTags = ["v*"],
PublishArtifacts = true,
- InvokedTargets = new[] { nameof(Verify), nameof(Cover), nameof(Publish) },
+ InvokedTargets = [nameof(Verify), nameof(Cover), nameof(Publish)],
EnableGitHubToken = true,
- ImportSecrets = new[] { Secrets.NuGetApiKey })]
-partial class Build : NukeBuild
+ ImportSecrets = [Secrets.NuGetApiKey])]
+class Build : NukeBuild
{
public static int Main() => Execute(x => x.Compile);
@@ -43,7 +43,7 @@ partial class Build : NukeBuild
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
- [Solution] readonly Solution Solution;
+ [Solution("AutoFixture.TUnit.sln")] readonly Solution Solution;
[GitRepository] readonly GitRepository GitRepository;
[GitVersion] readonly GitVersion GitVersion;
[CI] readonly GitHubActions GitHubActions;
@@ -51,14 +51,14 @@ partial class Build : NukeBuild
[Parameter("GitHub auth token", Name = "github-token"), Secret] readonly string GitHubToken;
[Parameter("Forces the continuous integration build flag")] readonly bool CI;
- [Secret] [Parameter("NuGet API Key (secret)", Name = Secrets.NuGetApiKey)] readonly string NuGetApiKey;
+ [Secret][Parameter("NuGet API Key (secret)", Name = Secrets.NuGetApiKey)] readonly string NuGetApiKey;
readonly string NuGetSource = "https://api.nuget.org/v3/index.json";
- IEnumerable Excluded => new[]
- {
+ IEnumerable Excluded =>
+ [
Solution.GetProject("_build"),
Solution.GetProject("TestTypeFoundation")
- };
+ ];
IEnumerable TestProjects => Solution.GetAllProjects("*Tests");
IEnumerable Libraries => Solution.Projects.Except(TestProjects).Except(Excluded);
@@ -147,7 +147,7 @@ partial class Build : NukeBuild
.Executes(() =>
{
ReportGenerator(_ => _
- .SetFramework("net5.0")
+ .SetFramework("net8.0")
.SetAssemblyFilters("-TestTypeFoundation*")
.SetReports(TestResultsDirectory / "**" / "coverage.cobertura.xml")
.SetTargetDirectory(ReportsDirectory)
diff --git a/build/Configuration.cs b/build/Configuration.cs
index 88c405b..171ec56 100644
--- a/build/Configuration.cs
+++ b/build/Configuration.cs
@@ -4,9 +4,9 @@
[TypeConverter(typeof(TypeConverter))]
public class Configuration : Enumeration
{
- public static Configuration Debug = new() { Value = nameof(Debug) };
- public static Configuration Release = new() { Value = nameof(Release) };
- public static Configuration Verify = new() { Value = nameof(Verify) };
+ public static readonly Configuration Debug = new() { Value = nameof(Debug) };
+ public static readonly Configuration Release = new() { Value = nameof(Release) };
+ public static readonly Configuration Verify = new() { Value = nameof(Verify) };
public static implicit operator string(Configuration configuration)
{
diff --git a/build/GitHubActionsExtensions.cs b/build/GitHubActionsExtensions.cs
index 3c811e3..cf74351 100644
--- a/build/GitHubActionsExtensions.cs
+++ b/build/GitHubActionsExtensions.cs
@@ -1,15 +1,16 @@
using System.Text.RegularExpressions;
+using Nuke.Common.CI.GitHubActions;
-namespace Nuke.Common.CI.GitHubActions
+public static partial class GitHubActionsExtensions
{
- public static class GitHubActionsExtensions
- {
- private static readonly Regex SemVerRef = new(@"^refs\/tags\/v(?\d+\.\d+\.\d+)", RegexOptions.Compiled);
+ private static readonly Regex SemVerRef = GetSemVerRegex();
- public static bool IsOnSemVerTag(this GitHubActions source)
- {
- return !string.IsNullOrWhiteSpace(source?.Ref)
- && SemVerRef.IsMatch(source.Ref);
- }
+ public static bool IsOnSemVerTag(this GitHubActions source)
+ {
+ return !string.IsNullOrWhiteSpace(source?.Ref)
+ && SemVerRef.IsMatch(source.Ref);
}
+
+ [GeneratedRegex(@"^refs\/tags\/v(?\d+\.\d+\.\d+)", RegexOptions.Compiled)]
+ private static partial Regex GetSemVerRegex();
}
\ No newline at end of file
diff --git a/build/_build.csproj b/build/_build.csproj
index 40a4f34..5e49830 100644
--- a/build/_build.csproj
+++ b/build/_build.csproj
@@ -12,6 +12,7 @@
$(NoWarn);NETSDK1138;NU1902;NU1903
Debug;Release;Verify
+ false
diff --git a/src/AutoFixture.TUnit/ArgumentsAutoDataAttribute.cs b/src/AutoFixture.TUnit/ArgumentsAutoDataAttribute.cs
new file mode 100644
index 0000000..efe3543
--- /dev/null
+++ b/src/AutoFixture.TUnit/ArgumentsAutoDataAttribute.cs
@@ -0,0 +1,52 @@
+using System.Diagnostics.CodeAnalysis;
+using AutoFixture.TUnit.Internal;
+
+namespace AutoFixture.TUnit;
+
+///
+/// Provides a data source for a data theory, with the data coming from inline
+/// values combined with auto-generated data specimens generated by AutoFixture.
+///
+[SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes",
+ Justification = "This attribute is the root of a potential attribute hierarchy.")]
+public class ArgumentsAutoDataAttribute : AutoFixtureDataSourceAttribute
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The data values to pass to the theory.
+ public ArgumentsAutoDataAttribute(params object?[] values)
+ : this(() => new Fixture(), values)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The fixture factory.
+ /// The data values to pass to the theory.
+ ///
+ protected ArgumentsAutoDataAttribute(Func fixtureFactory, params object?[]? values)
+ {
+ this.FixtureFactory = fixtureFactory ?? throw new ArgumentNullException(nameof(fixtureFactory));
+ this.Values = values ?? [null];
+ }
+
+ ///
+ /// Gets the fixture factory.
+ ///
+ public Func FixtureFactory { get; }
+
+ ///
+ /// Gets the data values to pass to the theory.
+ ///
+ public object?[] Values { get; }
+
+ ///
+ public override IEnumerable