From 21122ff02a865a1ba1a39bf62e83fa517e640e04 Mon Sep 17 00:00:00 2001 From: Robert Coltheart Date: Tue, 22 Sep 2026 06:45:17 +1000 Subject: [PATCH 01/10] Refactor project structure --- Machine.Specifications.slnx | 37 ++++++++++++------- ...hine.Specifications.Analyzers.Tests.csproj | 25 ------------- ...Specifications.Core.SourceGenerator.csproj | 7 ++++ ...hine.Specifications.Fakes.Analyzers.csproj | 7 ++++ ...pecifications.Fakes.SourceGenerator.csproj | 7 ++++ .../Machine.Specifications.Interfaces.csproj | 20 ---------- .../Machine.Specifications.Templates.csproj | 7 ++++ .../AnalyzerVerifier.cs | 0 .../CodeFixVerifier.cs | 0 ...hine.Specifications.Analyzers.Specs.csproj | 9 +++++ .../AccessModifierShouldNotBeUsedTests.cs | 0 .../VerifierHelper.cs | 0 ...ications.Core.SourceGenerator.Specs.csproj | 9 +++++ .../.editorconfig | 0 .../CatchSpecs.cs | 0 .../Controller/ControllerSpecs.cs | 0 .../ExceptionResultSpecs.cs | 0 .../Explorers/AssemblyExplorerSpecs.cs | 0 .../Factories/ContextFactorySpecs.cs | 0 .../Factories/SpecificationFactorySpecs.cs | 0 .../Machine.Specifications.Core.Specs.csproj | 1 - .../Model/ContextSpecs.cs | 0 .../Model/SpecificationSpecs.cs | 0 .../Runner/AsyncDelegateRunnerSpecs.cs | 0 .../Runner/SpecificationRunnerSpecs.cs | 0 .../SpecificationRunnerWithBehaviorSpecs.cs | 0 ...SpecificationRunnerWithInheritanceSpecs.cs | 0 .../Machine.Specifications.Core.Specs/Tags.cs | 0 .../Utility/Internal/NamingSpecs.cs | 0 ...pecifications.Fakes.Analzyers.Specs.csproj | 9 +++++ ...cations.Fakes.SourceGenerator.Specs.csproj | 9 +++++ .../DeepFake.cs | 0 .../Machine.Specifications.Fakes.Specs.csproj | 1 - .../TestSpec.cs | 0 .../ExampleFixture.cs | 0 .../FailingFixture.cs | 0 .../LargeFixture.cs | 0 .../Machine.Specifications.Fixtures.csproj | 0 .../RandomFixture.cs | 0 .../.editorconfig | 0 .../AppDomainRunnerSpecs.cs | 0 .../CompileContext.cs | 0 .../CustomDelegateSpecs.cs | 0 ...Specifications.Runner.Utility.Specs.csproj | 1 - .../RemoteRunListenerSpecs.cs | 0 .../FixtureCode.cs | 0 ...ations.Runner.VisualStudio.Fixtures.csproj | 0 .../.editorconfig | 0 .../Discovery/BehaviorsSpecs.cs | 0 .../Discovery/CustomActAssertSpecs.cs | 0 .../Discovery/DisabledTestNameOffSpecs.cs | 0 .../Discovery/DiscoverySpecs.cs | 0 .../Discovery/NestedTypesDiscoverySpecs.cs | 0 .../Discovery/WithDiscoverySetup.cs | 0 .../DiscoveryUnhandledErrorSpecs.cs | 0 .../WhenSpecificationEndsWithAFail.cs | 0 .../WhenSpecificationEndsWithAPass.cs | 0 .../RunListener/WhenSpecificationStarts.cs | 0 .../RunListener/WhenThereIsAnErrorReported.cs | 0 .../Execution/WhenCleaningUpAContext.cs | 0 .../Execution/WhenRunningANestedSpecPasses.cs | 0 .../WhenRunningASingleBehaviorPasses.cs | 0 .../Execution/WhenRunningASpecThatFails.cs | 0 .../WhenRunningASpecThatIsIgnored.cs | 0 .../WhenRunningASpecThatIsNotImplemented.cs | 0 .../Execution/WhenRunningASpecThatPasses.cs | 0 .../Execution/WhenRunningASpecThatThrows.cs | 0 ...ASpecWithCustomActAssertDelegatesPasses.cs | 0 .../WhenRunningAnAssemblyWithBehaviors.cs | 0 .../Execution/WithAssemblyExecutionSetup.cs | 0 .../WithMultipleSpecExecutionSetup.cs | 0 .../Execution/WithSingleSpecExecutionSetup.cs | 0 .../ExecutionUnhandledErrorSpecs.cs | 0 ...fications.Runner.VisualStudio.Specs.csproj | 0 .../.editorconfig | 0 .../AssertionSpecs.cs | 0 ...Machine.Specifications.Should.Specs.csproj | 1 - .../ShouldBeCloseToSpecs.cs | 0 .../ShouldBeLikeSpecs.cs | 0 .../Utility/Internal/ErrorMessageSpecs.cs | 0 .../Utility/ObjectGraphHelperSpecs.cs | 0 81 files changed, 88 insertions(+), 62 deletions(-) delete mode 100644 src/Machine.Specifications.Analyzers.Tests/Machine.Specifications.Analyzers.Tests.csproj create mode 100644 src/Machine.Specifications.Core.SourceGenerator/Machine.Specifications.Core.SourceGenerator.csproj create mode 100644 src/Machine.Specifications.Fakes.Analyzers/Machine.Specifications.Fakes.Analyzers.csproj create mode 100644 src/Machine.Specifications.Fakes.SourceGenerator/Machine.Specifications.Fakes.SourceGenerator.csproj delete mode 100644 src/Machine.Specifications.Interfaces/Machine.Specifications.Interfaces.csproj create mode 100644 src/Machine.Specifications.Templates/Machine.Specifications.Templates.csproj rename {src/Machine.Specifications.Analyzers.Tests => tests/Machine.Specifications.Analyzers.Specs}/AnalyzerVerifier.cs (100%) rename {src/Machine.Specifications.Analyzers.Tests => tests/Machine.Specifications.Analyzers.Specs}/CodeFixVerifier.cs (100%) create mode 100644 tests/Machine.Specifications.Analyzers.Specs/Machine.Specifications.Analyzers.Specs.csproj rename {src/Machine.Specifications.Analyzers.Tests => tests/Machine.Specifications.Analyzers.Specs}/Maintainability/AccessModifierShouldNotBeUsedTests.cs (100%) rename {src/Machine.Specifications.Analyzers.Tests => tests/Machine.Specifications.Analyzers.Specs}/VerifierHelper.cs (100%) create mode 100644 tests/Machine.Specifications.Core.SourceGenerator.Specs/Machine.Specifications.Core.SourceGenerator.Specs.csproj rename {src => tests}/Machine.Specifications.Core.Specs/.editorconfig (100%) rename {src => tests}/Machine.Specifications.Core.Specs/CatchSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Core.Specs/Controller/ControllerSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Core.Specs/ExceptionResultSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Core.Specs/Explorers/AssemblyExplorerSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Core.Specs/Factories/ContextFactorySpecs.cs (100%) rename {src => tests}/Machine.Specifications.Core.Specs/Factories/SpecificationFactorySpecs.cs (100%) rename {src => tests}/Machine.Specifications.Core.Specs/Machine.Specifications.Core.Specs.csproj (82%) rename {src => tests}/Machine.Specifications.Core.Specs/Model/ContextSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Core.Specs/Model/SpecificationSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Core.Specs/Runner/AsyncDelegateRunnerSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Core.Specs/Runner/SpecificationRunnerSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Core.Specs/Runner/SpecificationRunnerWithBehaviorSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Core.Specs/Runner/SpecificationRunnerWithInheritanceSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Core.Specs/Tags.cs (100%) rename {src => tests}/Machine.Specifications.Core.Specs/Utility/Internal/NamingSpecs.cs (100%) create mode 100644 tests/Machine.Specifications.Fakes.Analzyers.Specs/Machine.Specifications.Fakes.Analzyers.Specs.csproj create mode 100644 tests/Machine.Specifications.Fakes.SourceGenerator.Specs/Machine.Specifications.Fakes.SourceGenerator.Specs.csproj rename {src => tests}/Machine.Specifications.Fakes.Specs/DeepFake.cs (100%) rename {src => tests}/Machine.Specifications.Fakes.Specs/Machine.Specifications.Fakes.Specs.csproj (82%) rename {src => tests}/Machine.Specifications.Fakes.Specs/TestSpec.cs (100%) rename {src => tests}/Machine.Specifications.Fixtures/ExampleFixture.cs (100%) rename {src => tests}/Machine.Specifications.Fixtures/FailingFixture.cs (100%) rename {src => tests}/Machine.Specifications.Fixtures/LargeFixture.cs (100%) rename {src => tests}/Machine.Specifications.Fixtures/Machine.Specifications.Fixtures.csproj (100%) rename {src => tests}/Machine.Specifications.Fixtures/RandomFixture.cs (100%) rename {src => tests}/Machine.Specifications.Runner.Utility.Specs/.editorconfig (100%) rename {src => tests}/Machine.Specifications.Runner.Utility.Specs/AppDomainRunnerSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Runner.Utility.Specs/CompileContext.cs (100%) rename {src => tests}/Machine.Specifications.Runner.Utility.Specs/CustomDelegateSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Runner.Utility.Specs/Machine.Specifications.Runner.Utility.Specs.csproj (84%) rename {src => tests}/Machine.Specifications.Runner.Utility.Specs/RemoteRunListenerSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Fixtures/FixtureCode.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Fixtures/Machine.Specifications.Runner.VisualStudio.Fixtures.csproj (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/.editorconfig (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/BehaviorsSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/CustomActAssertSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/DisabledTestNameOffSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/DiscoverySpecs.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/NestedTypesDiscoverySpecs.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/WithDiscoverySetup.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/DiscoveryUnhandledErrorSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Execution/RunListener/WhenSpecificationEndsWithAFail.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Execution/RunListener/WhenSpecificationEndsWithAPass.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Execution/RunListener/WhenSpecificationStarts.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Execution/RunListener/WhenThereIsAnErrorReported.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenCleaningUpAContext.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningANestedSpecPasses.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASingleBehaviorPasses.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatFails.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatIsIgnored.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatIsNotImplemented.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatPasses.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatThrows.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecWithCustomActAssertDelegatesPasses.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningAnAssemblyWithBehaviors.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WithAssemblyExecutionSetup.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WithMultipleSpecExecutionSetup.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WithSingleSpecExecutionSetup.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/ExecutionUnhandledErrorSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Runner.VisualStudio.Specs/Machine.Specifications.Runner.VisualStudio.Specs.csproj (100%) rename {src => tests}/Machine.Specifications.Should.Specs/.editorconfig (100%) rename {src => tests}/Machine.Specifications.Should.Specs/AssertionSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Should.Specs/Machine.Specifications.Should.Specs.csproj (79%) rename {src => tests}/Machine.Specifications.Should.Specs/ShouldBeCloseToSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Should.Specs/ShouldBeLikeSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Should.Specs/Utility/Internal/ErrorMessageSpecs.cs (100%) rename {src => tests}/Machine.Specifications.Should.Specs/Utility/ObjectGraphHelperSpecs.cs (100%) diff --git a/Machine.Specifications.slnx b/Machine.Specifications.slnx index 7e57ad360..cd609bd08 100644 --- a/Machine.Specifications.slnx +++ b/Machine.Specifications.slnx @@ -1,15 +1,26 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Machine.Specifications.Analyzers.Tests/Machine.Specifications.Analyzers.Tests.csproj b/src/Machine.Specifications.Analyzers.Tests/Machine.Specifications.Analyzers.Tests.csproj deleted file mode 100644 index 7047e919d..000000000 --- a/src/Machine.Specifications.Analyzers.Tests/Machine.Specifications.Analyzers.Tests.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - net10.0 - Exe - true - false - - - - - - - - - - - - - - - - - - diff --git a/src/Machine.Specifications.Core.SourceGenerator/Machine.Specifications.Core.SourceGenerator.csproj b/src/Machine.Specifications.Core.SourceGenerator/Machine.Specifications.Core.SourceGenerator.csproj new file mode 100644 index 000000000..dbdcea46b --- /dev/null +++ b/src/Machine.Specifications.Core.SourceGenerator/Machine.Specifications.Core.SourceGenerator.csproj @@ -0,0 +1,7 @@ + + + + netstandard2.0 + + + diff --git a/src/Machine.Specifications.Fakes.Analyzers/Machine.Specifications.Fakes.Analyzers.csproj b/src/Machine.Specifications.Fakes.Analyzers/Machine.Specifications.Fakes.Analyzers.csproj new file mode 100644 index 000000000..dbdcea46b --- /dev/null +++ b/src/Machine.Specifications.Fakes.Analyzers/Machine.Specifications.Fakes.Analyzers.csproj @@ -0,0 +1,7 @@ + + + + netstandard2.0 + + + diff --git a/src/Machine.Specifications.Fakes.SourceGenerator/Machine.Specifications.Fakes.SourceGenerator.csproj b/src/Machine.Specifications.Fakes.SourceGenerator/Machine.Specifications.Fakes.SourceGenerator.csproj new file mode 100644 index 000000000..dbdcea46b --- /dev/null +++ b/src/Machine.Specifications.Fakes.SourceGenerator/Machine.Specifications.Fakes.SourceGenerator.csproj @@ -0,0 +1,7 @@ + + + + netstandard2.0 + + + diff --git a/src/Machine.Specifications.Interfaces/Machine.Specifications.Interfaces.csproj b/src/Machine.Specifications.Interfaces/Machine.Specifications.Interfaces.csproj deleted file mode 100644 index f63243811..000000000 --- a/src/Machine.Specifications.Interfaces/Machine.Specifications.Interfaces.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - netstandard2.0 - Machine.Specifications - - SDK and common runner interfaces used by Machine.Specifications - Machine Specifications - test;unit;testing;context;specification;bdd;tdd;mspec - https://github.com/machine/machine.specifications/releases - icon.png - http://github.com/machine/machine.specifications - MIT - - - - - - - diff --git a/src/Machine.Specifications.Templates/Machine.Specifications.Templates.csproj b/src/Machine.Specifications.Templates/Machine.Specifications.Templates.csproj new file mode 100644 index 000000000..dbdcea46b --- /dev/null +++ b/src/Machine.Specifications.Templates/Machine.Specifications.Templates.csproj @@ -0,0 +1,7 @@ + + + + netstandard2.0 + + + diff --git a/src/Machine.Specifications.Analyzers.Tests/AnalyzerVerifier.cs b/tests/Machine.Specifications.Analyzers.Specs/AnalyzerVerifier.cs similarity index 100% rename from src/Machine.Specifications.Analyzers.Tests/AnalyzerVerifier.cs rename to tests/Machine.Specifications.Analyzers.Specs/AnalyzerVerifier.cs diff --git a/src/Machine.Specifications.Analyzers.Tests/CodeFixVerifier.cs b/tests/Machine.Specifications.Analyzers.Specs/CodeFixVerifier.cs similarity index 100% rename from src/Machine.Specifications.Analyzers.Tests/CodeFixVerifier.cs rename to tests/Machine.Specifications.Analyzers.Specs/CodeFixVerifier.cs diff --git a/tests/Machine.Specifications.Analyzers.Specs/Machine.Specifications.Analyzers.Specs.csproj b/tests/Machine.Specifications.Analyzers.Specs/Machine.Specifications.Analyzers.Specs.csproj new file mode 100644 index 000000000..b76014470 --- /dev/null +++ b/tests/Machine.Specifications.Analyzers.Specs/Machine.Specifications.Analyzers.Specs.csproj @@ -0,0 +1,9 @@ + + + + net10.0 + enable + enable + + + diff --git a/src/Machine.Specifications.Analyzers.Tests/Maintainability/AccessModifierShouldNotBeUsedTests.cs b/tests/Machine.Specifications.Analyzers.Specs/Maintainability/AccessModifierShouldNotBeUsedTests.cs similarity index 100% rename from src/Machine.Specifications.Analyzers.Tests/Maintainability/AccessModifierShouldNotBeUsedTests.cs rename to tests/Machine.Specifications.Analyzers.Specs/Maintainability/AccessModifierShouldNotBeUsedTests.cs diff --git a/src/Machine.Specifications.Analyzers.Tests/VerifierHelper.cs b/tests/Machine.Specifications.Analyzers.Specs/VerifierHelper.cs similarity index 100% rename from src/Machine.Specifications.Analyzers.Tests/VerifierHelper.cs rename to tests/Machine.Specifications.Analyzers.Specs/VerifierHelper.cs diff --git a/tests/Machine.Specifications.Core.SourceGenerator.Specs/Machine.Specifications.Core.SourceGenerator.Specs.csproj b/tests/Machine.Specifications.Core.SourceGenerator.Specs/Machine.Specifications.Core.SourceGenerator.Specs.csproj new file mode 100644 index 000000000..b76014470 --- /dev/null +++ b/tests/Machine.Specifications.Core.SourceGenerator.Specs/Machine.Specifications.Core.SourceGenerator.Specs.csproj @@ -0,0 +1,9 @@ + + + + net10.0 + enable + enable + + + diff --git a/src/Machine.Specifications.Core.Specs/.editorconfig b/tests/Machine.Specifications.Core.Specs/.editorconfig similarity index 100% rename from src/Machine.Specifications.Core.Specs/.editorconfig rename to tests/Machine.Specifications.Core.Specs/.editorconfig diff --git a/src/Machine.Specifications.Core.Specs/CatchSpecs.cs b/tests/Machine.Specifications.Core.Specs/CatchSpecs.cs similarity index 100% rename from src/Machine.Specifications.Core.Specs/CatchSpecs.cs rename to tests/Machine.Specifications.Core.Specs/CatchSpecs.cs diff --git a/src/Machine.Specifications.Core.Specs/Controller/ControllerSpecs.cs b/tests/Machine.Specifications.Core.Specs/Controller/ControllerSpecs.cs similarity index 100% rename from src/Machine.Specifications.Core.Specs/Controller/ControllerSpecs.cs rename to tests/Machine.Specifications.Core.Specs/Controller/ControllerSpecs.cs diff --git a/src/Machine.Specifications.Core.Specs/ExceptionResultSpecs.cs b/tests/Machine.Specifications.Core.Specs/ExceptionResultSpecs.cs similarity index 100% rename from src/Machine.Specifications.Core.Specs/ExceptionResultSpecs.cs rename to tests/Machine.Specifications.Core.Specs/ExceptionResultSpecs.cs diff --git a/src/Machine.Specifications.Core.Specs/Explorers/AssemblyExplorerSpecs.cs b/tests/Machine.Specifications.Core.Specs/Explorers/AssemblyExplorerSpecs.cs similarity index 100% rename from src/Machine.Specifications.Core.Specs/Explorers/AssemblyExplorerSpecs.cs rename to tests/Machine.Specifications.Core.Specs/Explorers/AssemblyExplorerSpecs.cs diff --git a/src/Machine.Specifications.Core.Specs/Factories/ContextFactorySpecs.cs b/tests/Machine.Specifications.Core.Specs/Factories/ContextFactorySpecs.cs similarity index 100% rename from src/Machine.Specifications.Core.Specs/Factories/ContextFactorySpecs.cs rename to tests/Machine.Specifications.Core.Specs/Factories/ContextFactorySpecs.cs diff --git a/src/Machine.Specifications.Core.Specs/Factories/SpecificationFactorySpecs.cs b/tests/Machine.Specifications.Core.Specs/Factories/SpecificationFactorySpecs.cs similarity index 100% rename from src/Machine.Specifications.Core.Specs/Factories/SpecificationFactorySpecs.cs rename to tests/Machine.Specifications.Core.Specs/Factories/SpecificationFactorySpecs.cs diff --git a/src/Machine.Specifications.Core.Specs/Machine.Specifications.Core.Specs.csproj b/tests/Machine.Specifications.Core.Specs/Machine.Specifications.Core.Specs.csproj similarity index 82% rename from src/Machine.Specifications.Core.Specs/Machine.Specifications.Core.Specs.csproj rename to tests/Machine.Specifications.Core.Specs/Machine.Specifications.Core.Specs.csproj index 80c9588be..4c9f5092f 100644 --- a/src/Machine.Specifications.Core.Specs/Machine.Specifications.Core.Specs.csproj +++ b/tests/Machine.Specifications.Core.Specs/Machine.Specifications.Core.Specs.csproj @@ -12,7 +12,6 @@ - diff --git a/src/Machine.Specifications.Core.Specs/Model/ContextSpecs.cs b/tests/Machine.Specifications.Core.Specs/Model/ContextSpecs.cs similarity index 100% rename from src/Machine.Specifications.Core.Specs/Model/ContextSpecs.cs rename to tests/Machine.Specifications.Core.Specs/Model/ContextSpecs.cs diff --git a/src/Machine.Specifications.Core.Specs/Model/SpecificationSpecs.cs b/tests/Machine.Specifications.Core.Specs/Model/SpecificationSpecs.cs similarity index 100% rename from src/Machine.Specifications.Core.Specs/Model/SpecificationSpecs.cs rename to tests/Machine.Specifications.Core.Specs/Model/SpecificationSpecs.cs diff --git a/src/Machine.Specifications.Core.Specs/Runner/AsyncDelegateRunnerSpecs.cs b/tests/Machine.Specifications.Core.Specs/Runner/AsyncDelegateRunnerSpecs.cs similarity index 100% rename from src/Machine.Specifications.Core.Specs/Runner/AsyncDelegateRunnerSpecs.cs rename to tests/Machine.Specifications.Core.Specs/Runner/AsyncDelegateRunnerSpecs.cs diff --git a/src/Machine.Specifications.Core.Specs/Runner/SpecificationRunnerSpecs.cs b/tests/Machine.Specifications.Core.Specs/Runner/SpecificationRunnerSpecs.cs similarity index 100% rename from src/Machine.Specifications.Core.Specs/Runner/SpecificationRunnerSpecs.cs rename to tests/Machine.Specifications.Core.Specs/Runner/SpecificationRunnerSpecs.cs diff --git a/src/Machine.Specifications.Core.Specs/Runner/SpecificationRunnerWithBehaviorSpecs.cs b/tests/Machine.Specifications.Core.Specs/Runner/SpecificationRunnerWithBehaviorSpecs.cs similarity index 100% rename from src/Machine.Specifications.Core.Specs/Runner/SpecificationRunnerWithBehaviorSpecs.cs rename to tests/Machine.Specifications.Core.Specs/Runner/SpecificationRunnerWithBehaviorSpecs.cs diff --git a/src/Machine.Specifications.Core.Specs/Runner/SpecificationRunnerWithInheritanceSpecs.cs b/tests/Machine.Specifications.Core.Specs/Runner/SpecificationRunnerWithInheritanceSpecs.cs similarity index 100% rename from src/Machine.Specifications.Core.Specs/Runner/SpecificationRunnerWithInheritanceSpecs.cs rename to tests/Machine.Specifications.Core.Specs/Runner/SpecificationRunnerWithInheritanceSpecs.cs diff --git a/src/Machine.Specifications.Core.Specs/Tags.cs b/tests/Machine.Specifications.Core.Specs/Tags.cs similarity index 100% rename from src/Machine.Specifications.Core.Specs/Tags.cs rename to tests/Machine.Specifications.Core.Specs/Tags.cs diff --git a/src/Machine.Specifications.Core.Specs/Utility/Internal/NamingSpecs.cs b/tests/Machine.Specifications.Core.Specs/Utility/Internal/NamingSpecs.cs similarity index 100% rename from src/Machine.Specifications.Core.Specs/Utility/Internal/NamingSpecs.cs rename to tests/Machine.Specifications.Core.Specs/Utility/Internal/NamingSpecs.cs diff --git a/tests/Machine.Specifications.Fakes.Analzyers.Specs/Machine.Specifications.Fakes.Analzyers.Specs.csproj b/tests/Machine.Specifications.Fakes.Analzyers.Specs/Machine.Specifications.Fakes.Analzyers.Specs.csproj new file mode 100644 index 000000000..b76014470 --- /dev/null +++ b/tests/Machine.Specifications.Fakes.Analzyers.Specs/Machine.Specifications.Fakes.Analzyers.Specs.csproj @@ -0,0 +1,9 @@ + + + + net10.0 + enable + enable + + + diff --git a/tests/Machine.Specifications.Fakes.SourceGenerator.Specs/Machine.Specifications.Fakes.SourceGenerator.Specs.csproj b/tests/Machine.Specifications.Fakes.SourceGenerator.Specs/Machine.Specifications.Fakes.SourceGenerator.Specs.csproj new file mode 100644 index 000000000..b76014470 --- /dev/null +++ b/tests/Machine.Specifications.Fakes.SourceGenerator.Specs/Machine.Specifications.Fakes.SourceGenerator.Specs.csproj @@ -0,0 +1,9 @@ + + + + net10.0 + enable + enable + + + diff --git a/src/Machine.Specifications.Fakes.Specs/DeepFake.cs b/tests/Machine.Specifications.Fakes.Specs/DeepFake.cs similarity index 100% rename from src/Machine.Specifications.Fakes.Specs/DeepFake.cs rename to tests/Machine.Specifications.Fakes.Specs/DeepFake.cs diff --git a/src/Machine.Specifications.Fakes.Specs/Machine.Specifications.Fakes.Specs.csproj b/tests/Machine.Specifications.Fakes.Specs/Machine.Specifications.Fakes.Specs.csproj similarity index 82% rename from src/Machine.Specifications.Fakes.Specs/Machine.Specifications.Fakes.Specs.csproj rename to tests/Machine.Specifications.Fakes.Specs/Machine.Specifications.Fakes.Specs.csproj index ba4c133d1..96a11b590 100644 --- a/src/Machine.Specifications.Fakes.Specs/Machine.Specifications.Fakes.Specs.csproj +++ b/tests/Machine.Specifications.Fakes.Specs/Machine.Specifications.Fakes.Specs.csproj @@ -12,7 +12,6 @@ - diff --git a/src/Machine.Specifications.Fakes.Specs/TestSpec.cs b/tests/Machine.Specifications.Fakes.Specs/TestSpec.cs similarity index 100% rename from src/Machine.Specifications.Fakes.Specs/TestSpec.cs rename to tests/Machine.Specifications.Fakes.Specs/TestSpec.cs diff --git a/src/Machine.Specifications.Fixtures/ExampleFixture.cs b/tests/Machine.Specifications.Fixtures/ExampleFixture.cs similarity index 100% rename from src/Machine.Specifications.Fixtures/ExampleFixture.cs rename to tests/Machine.Specifications.Fixtures/ExampleFixture.cs diff --git a/src/Machine.Specifications.Fixtures/FailingFixture.cs b/tests/Machine.Specifications.Fixtures/FailingFixture.cs similarity index 100% rename from src/Machine.Specifications.Fixtures/FailingFixture.cs rename to tests/Machine.Specifications.Fixtures/FailingFixture.cs diff --git a/src/Machine.Specifications.Fixtures/LargeFixture.cs b/tests/Machine.Specifications.Fixtures/LargeFixture.cs similarity index 100% rename from src/Machine.Specifications.Fixtures/LargeFixture.cs rename to tests/Machine.Specifications.Fixtures/LargeFixture.cs diff --git a/src/Machine.Specifications.Fixtures/Machine.Specifications.Fixtures.csproj b/tests/Machine.Specifications.Fixtures/Machine.Specifications.Fixtures.csproj similarity index 100% rename from src/Machine.Specifications.Fixtures/Machine.Specifications.Fixtures.csproj rename to tests/Machine.Specifications.Fixtures/Machine.Specifications.Fixtures.csproj diff --git a/src/Machine.Specifications.Fixtures/RandomFixture.cs b/tests/Machine.Specifications.Fixtures/RandomFixture.cs similarity index 100% rename from src/Machine.Specifications.Fixtures/RandomFixture.cs rename to tests/Machine.Specifications.Fixtures/RandomFixture.cs diff --git a/src/Machine.Specifications.Runner.Utility.Specs/.editorconfig b/tests/Machine.Specifications.Runner.Utility.Specs/.editorconfig similarity index 100% rename from src/Machine.Specifications.Runner.Utility.Specs/.editorconfig rename to tests/Machine.Specifications.Runner.Utility.Specs/.editorconfig diff --git a/src/Machine.Specifications.Runner.Utility.Specs/AppDomainRunnerSpecs.cs b/tests/Machine.Specifications.Runner.Utility.Specs/AppDomainRunnerSpecs.cs similarity index 100% rename from src/Machine.Specifications.Runner.Utility.Specs/AppDomainRunnerSpecs.cs rename to tests/Machine.Specifications.Runner.Utility.Specs/AppDomainRunnerSpecs.cs diff --git a/src/Machine.Specifications.Runner.Utility.Specs/CompileContext.cs b/tests/Machine.Specifications.Runner.Utility.Specs/CompileContext.cs similarity index 100% rename from src/Machine.Specifications.Runner.Utility.Specs/CompileContext.cs rename to tests/Machine.Specifications.Runner.Utility.Specs/CompileContext.cs diff --git a/src/Machine.Specifications.Runner.Utility.Specs/CustomDelegateSpecs.cs b/tests/Machine.Specifications.Runner.Utility.Specs/CustomDelegateSpecs.cs similarity index 100% rename from src/Machine.Specifications.Runner.Utility.Specs/CustomDelegateSpecs.cs rename to tests/Machine.Specifications.Runner.Utility.Specs/CustomDelegateSpecs.cs diff --git a/src/Machine.Specifications.Runner.Utility.Specs/Machine.Specifications.Runner.Utility.Specs.csproj b/tests/Machine.Specifications.Runner.Utility.Specs/Machine.Specifications.Runner.Utility.Specs.csproj similarity index 84% rename from src/Machine.Specifications.Runner.Utility.Specs/Machine.Specifications.Runner.Utility.Specs.csproj rename to tests/Machine.Specifications.Runner.Utility.Specs/Machine.Specifications.Runner.Utility.Specs.csproj index 73c3fc6d9..662ef0631 100644 --- a/src/Machine.Specifications.Runner.Utility.Specs/Machine.Specifications.Runner.Utility.Specs.csproj +++ b/tests/Machine.Specifications.Runner.Utility.Specs/Machine.Specifications.Runner.Utility.Specs.csproj @@ -13,7 +13,6 @@ - diff --git a/src/Machine.Specifications.Runner.Utility.Specs/RemoteRunListenerSpecs.cs b/tests/Machine.Specifications.Runner.Utility.Specs/RemoteRunListenerSpecs.cs similarity index 100% rename from src/Machine.Specifications.Runner.Utility.Specs/RemoteRunListenerSpecs.cs rename to tests/Machine.Specifications.Runner.Utility.Specs/RemoteRunListenerSpecs.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Fixtures/FixtureCode.cs b/tests/Machine.Specifications.Runner.VisualStudio.Fixtures/FixtureCode.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Fixtures/FixtureCode.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Fixtures/FixtureCode.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Fixtures/Machine.Specifications.Runner.VisualStudio.Fixtures.csproj b/tests/Machine.Specifications.Runner.VisualStudio.Fixtures/Machine.Specifications.Runner.VisualStudio.Fixtures.csproj similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Fixtures/Machine.Specifications.Runner.VisualStudio.Fixtures.csproj rename to tests/Machine.Specifications.Runner.VisualStudio.Fixtures/Machine.Specifications.Runner.VisualStudio.Fixtures.csproj diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/.editorconfig b/tests/Machine.Specifications.Runner.VisualStudio.Specs/.editorconfig similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/.editorconfig rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/.editorconfig diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/BehaviorsSpecs.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/BehaviorsSpecs.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/BehaviorsSpecs.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/BehaviorsSpecs.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/CustomActAssertSpecs.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/CustomActAssertSpecs.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/CustomActAssertSpecs.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/CustomActAssertSpecs.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/DisabledTestNameOffSpecs.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/DisabledTestNameOffSpecs.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/DisabledTestNameOffSpecs.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/DisabledTestNameOffSpecs.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/DiscoverySpecs.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/DiscoverySpecs.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/DiscoverySpecs.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/DiscoverySpecs.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/NestedTypesDiscoverySpecs.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/NestedTypesDiscoverySpecs.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/NestedTypesDiscoverySpecs.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/NestedTypesDiscoverySpecs.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/WithDiscoverySetup.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/WithDiscoverySetup.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/WithDiscoverySetup.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/WithDiscoverySetup.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/DiscoveryUnhandledErrorSpecs.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/DiscoveryUnhandledErrorSpecs.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/DiscoveryUnhandledErrorSpecs.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/DiscoveryUnhandledErrorSpecs.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/RunListener/WhenSpecificationEndsWithAFail.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/RunListener/WhenSpecificationEndsWithAFail.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/RunListener/WhenSpecificationEndsWithAFail.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/RunListener/WhenSpecificationEndsWithAFail.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/RunListener/WhenSpecificationEndsWithAPass.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/RunListener/WhenSpecificationEndsWithAPass.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/RunListener/WhenSpecificationEndsWithAPass.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/RunListener/WhenSpecificationEndsWithAPass.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/RunListener/WhenSpecificationStarts.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/RunListener/WhenSpecificationStarts.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/RunListener/WhenSpecificationStarts.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/RunListener/WhenSpecificationStarts.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/RunListener/WhenThereIsAnErrorReported.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/RunListener/WhenThereIsAnErrorReported.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/RunListener/WhenThereIsAnErrorReported.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/RunListener/WhenThereIsAnErrorReported.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenCleaningUpAContext.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenCleaningUpAContext.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenCleaningUpAContext.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenCleaningUpAContext.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningANestedSpecPasses.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningANestedSpecPasses.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningANestedSpecPasses.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningANestedSpecPasses.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASingleBehaviorPasses.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASingleBehaviorPasses.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASingleBehaviorPasses.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASingleBehaviorPasses.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatFails.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatFails.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatFails.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatFails.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatIsIgnored.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatIsIgnored.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatIsIgnored.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatIsIgnored.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatIsNotImplemented.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatIsNotImplemented.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatIsNotImplemented.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatIsNotImplemented.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatPasses.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatPasses.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatPasses.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatPasses.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatThrows.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatThrows.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatThrows.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecThatThrows.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecWithCustomActAssertDelegatesPasses.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecWithCustomActAssertDelegatesPasses.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecWithCustomActAssertDelegatesPasses.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningASpecWithCustomActAssertDelegatesPasses.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningAnAssemblyWithBehaviors.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningAnAssemblyWithBehaviors.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningAnAssemblyWithBehaviors.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WhenRunningAnAssemblyWithBehaviors.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WithAssemblyExecutionSetup.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WithAssemblyExecutionSetup.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WithAssemblyExecutionSetup.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WithAssemblyExecutionSetup.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WithMultipleSpecExecutionSetup.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WithMultipleSpecExecutionSetup.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WithMultipleSpecExecutionSetup.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WithMultipleSpecExecutionSetup.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WithSingleSpecExecutionSetup.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WithSingleSpecExecutionSetup.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WithSingleSpecExecutionSetup.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Execution/WithSingleSpecExecutionSetup.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/ExecutionUnhandledErrorSpecs.cs b/tests/Machine.Specifications.Runner.VisualStudio.Specs/ExecutionUnhandledErrorSpecs.cs similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/ExecutionUnhandledErrorSpecs.cs rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/ExecutionUnhandledErrorSpecs.cs diff --git a/src/Machine.Specifications.Runner.VisualStudio.Specs/Machine.Specifications.Runner.VisualStudio.Specs.csproj b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Machine.Specifications.Runner.VisualStudio.Specs.csproj similarity index 100% rename from src/Machine.Specifications.Runner.VisualStudio.Specs/Machine.Specifications.Runner.VisualStudio.Specs.csproj rename to tests/Machine.Specifications.Runner.VisualStudio.Specs/Machine.Specifications.Runner.VisualStudio.Specs.csproj diff --git a/src/Machine.Specifications.Should.Specs/.editorconfig b/tests/Machine.Specifications.Should.Specs/.editorconfig similarity index 100% rename from src/Machine.Specifications.Should.Specs/.editorconfig rename to tests/Machine.Specifications.Should.Specs/.editorconfig diff --git a/src/Machine.Specifications.Should.Specs/AssertionSpecs.cs b/tests/Machine.Specifications.Should.Specs/AssertionSpecs.cs similarity index 100% rename from src/Machine.Specifications.Should.Specs/AssertionSpecs.cs rename to tests/Machine.Specifications.Should.Specs/AssertionSpecs.cs diff --git a/src/Machine.Specifications.Should.Specs/Machine.Specifications.Should.Specs.csproj b/tests/Machine.Specifications.Should.Specs/Machine.Specifications.Should.Specs.csproj similarity index 79% rename from src/Machine.Specifications.Should.Specs/Machine.Specifications.Should.Specs.csproj rename to tests/Machine.Specifications.Should.Specs/Machine.Specifications.Should.Specs.csproj index bee92a93c..5503a8041 100644 --- a/src/Machine.Specifications.Should.Specs/Machine.Specifications.Should.Specs.csproj +++ b/tests/Machine.Specifications.Should.Specs/Machine.Specifications.Should.Specs.csproj @@ -11,7 +11,6 @@ - diff --git a/src/Machine.Specifications.Should.Specs/ShouldBeCloseToSpecs.cs b/tests/Machine.Specifications.Should.Specs/ShouldBeCloseToSpecs.cs similarity index 100% rename from src/Machine.Specifications.Should.Specs/ShouldBeCloseToSpecs.cs rename to tests/Machine.Specifications.Should.Specs/ShouldBeCloseToSpecs.cs diff --git a/src/Machine.Specifications.Should.Specs/ShouldBeLikeSpecs.cs b/tests/Machine.Specifications.Should.Specs/ShouldBeLikeSpecs.cs similarity index 100% rename from src/Machine.Specifications.Should.Specs/ShouldBeLikeSpecs.cs rename to tests/Machine.Specifications.Should.Specs/ShouldBeLikeSpecs.cs diff --git a/src/Machine.Specifications.Should.Specs/Utility/Internal/ErrorMessageSpecs.cs b/tests/Machine.Specifications.Should.Specs/Utility/Internal/ErrorMessageSpecs.cs similarity index 100% rename from src/Machine.Specifications.Should.Specs/Utility/Internal/ErrorMessageSpecs.cs rename to tests/Machine.Specifications.Should.Specs/Utility/Internal/ErrorMessageSpecs.cs diff --git a/src/Machine.Specifications.Should.Specs/Utility/ObjectGraphHelperSpecs.cs b/tests/Machine.Specifications.Should.Specs/Utility/ObjectGraphHelperSpecs.cs similarity index 100% rename from src/Machine.Specifications.Should.Specs/Utility/ObjectGraphHelperSpecs.cs rename to tests/Machine.Specifications.Should.Specs/Utility/ObjectGraphHelperSpecs.cs From 213f242a2cfe2c3340b8a5d570a8947bc81d5841 Mon Sep 17 00:00:00 2001 From: Robert Coltheart Date: Wed, 23 Sep 2026 19:57:59 +1000 Subject: [PATCH 02/10] refactor projects --- Machine.Specifications.slnx | 8 +- .../Machine.Specifications.Analyzers.csproj | 2 +- src/Machine.Specifications.Core/Framework.cs | 2 + .../Machine.Specifications.Core.csproj | 2 +- .../Runner/Impl/DefaultRunner.cs | 10 +- .../Runner/Impl/RemoteRunListenerDecorator.cs | 2 +- .../Sdk/RemoteRunListenerDecorator.cs | 2 +- .../Sdk/RunSpecs.cs | 2 +- ...hine.Specifications.Analyzers.Specs.csproj | 12 + .../AccessModifierShouldNotBeUsedTests.cs | 82 +- .../Fixtures/ExampleFixture.cs | 91 ++ .../Fixtures/FailingFixture.cs | 35 + .../Fixtures/LargeFixture.cs | 1025 +++++++++++++++ .../Fixtures/RandomFixture.cs | 1158 +++++++++++++++++ .../Machine.Specifications.Core.Specs.csproj | 9 +- .../Machine.Specifications.Fakes.Specs.csproj | 10 +- ...Machine.Specifications.Should.Specs.csproj | 8 +- 17 files changed, 2390 insertions(+), 70 deletions(-) create mode 100644 tests/Machine.Specifications.Core.Specs/Fixtures/ExampleFixture.cs create mode 100644 tests/Machine.Specifications.Core.Specs/Fixtures/FailingFixture.cs create mode 100644 tests/Machine.Specifications.Core.Specs/Fixtures/LargeFixture.cs create mode 100644 tests/Machine.Specifications.Core.Specs/Fixtures/RandomFixture.cs diff --git a/Machine.Specifications.slnx b/Machine.Specifications.slnx index cd609bd08..870951541 100644 --- a/Machine.Specifications.slnx +++ b/Machine.Specifications.slnx @@ -1,20 +1,20 @@ - + - + - + - + diff --git a/src/Machine.Specifications.Analyzers/Machine.Specifications.Analyzers.csproj b/src/Machine.Specifications.Analyzers/Machine.Specifications.Analyzers.csproj index ecefb21de..74d8d02b4 100644 --- a/src/Machine.Specifications.Analyzers/Machine.Specifications.Analyzers.csproj +++ b/src/Machine.Specifications.Analyzers/Machine.Specifications.Analyzers.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/Machine.Specifications.Core/Framework.cs b/src/Machine.Specifications.Core/Framework.cs index 60ea270f3..f8338ad61 100644 --- a/src/Machine.Specifications.Core/Framework.cs +++ b/src/Machine.Specifications.Core/Framework.cs @@ -1,3 +1,5 @@ +using System.Linq.Expressions; + namespace Machine.Specifications { [SetupDelegate] diff --git a/src/Machine.Specifications.Core/Machine.Specifications.Core.csproj b/src/Machine.Specifications.Core/Machine.Specifications.Core.csproj index e06333496..eebcd5820 100644 --- a/src/Machine.Specifications.Core/Machine.Specifications.Core.csproj +++ b/src/Machine.Specifications.Core/Machine.Specifications.Core.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/Machine.Specifications.Core/Runner/Impl/DefaultRunner.cs b/src/Machine.Specifications.Core/Runner/Impl/DefaultRunner.cs index a2a283701..7de7d5da9 100644 --- a/src/Machine.Specifications.Core/Runner/Impl/DefaultRunner.cs +++ b/src/Machine.Specifications.Core/Runner/Impl/DefaultRunner.cs @@ -3,7 +3,7 @@ using System.IO; using System.Linq; using System.Reflection; -#if !NET6_0_OR_GREATER +#if !NETSTANDARD using System.Runtime.Remoting; using System.Runtime.Remoting.Messaging; #endif @@ -16,11 +16,11 @@ namespace Machine.Specifications.Runner.Impl { -#if !NET6_0_OR_GREATER +#if !NETSTANDARD [Serializable] #endif public class DefaultRunner : -#if !NET6_0_OR_GREATER +#if !NETSTANDARD MarshalByRefObject, IMessageSink, #endif ISpecificationRunner @@ -40,7 +40,7 @@ public class DefaultRunner : private bool explicitStartAndEnd; -#if !NET6_0_OR_GREATER +#if !NETSTANDARD public DefaultRunner(object listener, string runOptionsXml, bool signalRunStartAndEnd) : this(new RemoteRunListenerDecorator(listener), RunOptions.Parse(runOptionsXml), signalRunStartAndEnd) { @@ -173,7 +173,7 @@ public void EndRun(Assembly assembly) runEnd.Invoke(); } -#if !NET6_0_OR_GREATER +#if !NETSTANDARD [SecurityCritical] public override object InitializeLifetimeService() { diff --git a/src/Machine.Specifications.Core/Runner/Impl/RemoteRunListenerDecorator.cs b/src/Machine.Specifications.Core/Runner/Impl/RemoteRunListenerDecorator.cs index 7cd8b8d01..f7ac685b9 100644 --- a/src/Machine.Specifications.Core/Runner/Impl/RemoteRunListenerDecorator.cs +++ b/src/Machine.Specifications.Core/Runner/Impl/RemoteRunListenerDecorator.cs @@ -1,4 +1,4 @@ -#if !NET6_0_OR_GREATER +#if !NETSTANDARD using System; using System.Collections; using System.Collections.Generic; diff --git a/src/Machine.Specifications.Core/Sdk/RemoteRunListenerDecorator.cs b/src/Machine.Specifications.Core/Sdk/RemoteRunListenerDecorator.cs index b8c84f915..93eb8ca36 100644 --- a/src/Machine.Specifications.Core/Sdk/RemoteRunListenerDecorator.cs +++ b/src/Machine.Specifications.Core/Sdk/RemoteRunListenerDecorator.cs @@ -1,4 +1,4 @@ -#if !NET6_0_OR_GREATER +#if !NETSTANDARD using System; using System.Collections; diff --git a/src/Machine.Specifications.Core/Sdk/RunSpecs.cs b/src/Machine.Specifications.Core/Sdk/RunSpecs.cs index 21c300993..e5ca4c9d6 100644 --- a/src/Machine.Specifications.Core/Sdk/RunSpecs.cs +++ b/src/Machine.Specifications.Core/Sdk/RunSpecs.cs @@ -1,4 +1,4 @@ -#if !NET6_0_OR_GREATER +#if !NETSTANDARD using System.Collections.Generic; using System.Linq; diff --git a/tests/Machine.Specifications.Analyzers.Specs/Machine.Specifications.Analyzers.Specs.csproj b/tests/Machine.Specifications.Analyzers.Specs/Machine.Specifications.Analyzers.Specs.csproj index b76014470..73f2811d8 100644 --- a/tests/Machine.Specifications.Analyzers.Specs/Machine.Specifications.Analyzers.Specs.csproj +++ b/tests/Machine.Specifications.Analyzers.Specs/Machine.Specifications.Analyzers.Specs.csproj @@ -6,4 +6,16 @@ enable + + + + + + + + + + + + diff --git a/tests/Machine.Specifications.Analyzers.Specs/Maintainability/AccessModifierShouldNotBeUsedTests.cs b/tests/Machine.Specifications.Analyzers.Specs/Maintainability/AccessModifierShouldNotBeUsedTests.cs index 275b80c2c..8fc49bf73 100644 --- a/tests/Machine.Specifications.Analyzers.Specs/Maintainability/AccessModifierShouldNotBeUsedTests.cs +++ b/tests/Machine.Specifications.Analyzers.Specs/Maintainability/AccessModifierShouldNotBeUsedTests.cs @@ -1,5 +1,6 @@ -using System.Threading.Tasks; -using Xunit; +using System.Threading.Tasks; +using Machine.Specifications.Analyzers.Naming; +using Microsoft.CodeAnalysis.Testing; using Verify = Machine.Specifications.Analyzers.Tests.CodeFixVerifier< Machine.Specifications.Analyzers.Maintainability.AccessModifierShouldNotBeUsedAnalyzer, Machine.Specifications.Analyzers.Maintainability.AccessModifierShouldNotBeUsedCodeFixProvider>; @@ -8,8 +9,7 @@ namespace Machine.Specifications.Analyzers.Tests.Maintainability; public class AccessModifierShouldNotBeUsedTests { - [Fact] - public async Task NoErrorsInValidSource() + public class NoErrorsInValidSource { const string source = @" using System; @@ -31,12 +31,11 @@ class inner_specs } } }"; - - await Verify.VerifyAnalyzerAsync(source); + It should_verify = async () => + await Verify.VerifyAnalyzerAsync(source); } - [Fact] - public async Task RemovesClassAccessModifier() + public class RemovesClassAccessModifier() { const string source = @" using System; @@ -64,15 +63,18 @@ class SpecsClass } }"; - var expected = Verify.Diagnostic(DiagnosticIds.Maintainability.AccessModifierShouldNotBeUsed) - .WithLocation(0) - .WithArguments("SpecsClass"); + static DiagnosticResult expected; + + Because of = () => + expected = Verify.Diagnostic(DiagnosticIds.Maintainability.AccessModifierShouldNotBeUsed) + .WithLocation(0) + .WithArguments("SpecsClass"); - await Verify.VerifyCodeFixAsync(source, expected, fixedSource); + It should_verify = async () => + await Verify.VerifyCodeFixAsync(source, expected, fixedSource); } - [Fact] - public async Task RemovesFieldAccessModifier() + public class RemovesFieldAccessModifier { const string source = @" using System; @@ -100,15 +102,18 @@ class SpecsClass } }"; - var expected = Verify.Diagnostic(DiagnosticIds.Maintainability.AccessModifierShouldNotBeUsed) - .WithLocation(0) - .WithArguments("should_do_something"); + static DiagnosticResult expected; + + Because of = () => + expected = Verify.Diagnostic(DiagnosticIds.Maintainability.AccessModifierShouldNotBeUsed) + .WithLocation(0) + .WithArguments("should_do_something"); - await Verify.VerifyCodeFixAsync(source, expected, fixedSource); + It should_verify = async () => + await Verify.VerifyCodeFixAsync(source, expected, fixedSource); } - [Fact] - public async Task RemovesFieldAndClassAccessModifiers() + public class RemovesFieldAndClassAccessModifiers { const string source = @" using System; @@ -136,8 +141,10 @@ class SpecsClass } }"; - var expected = new[] - { + static DiagnosticResult[] expected; + + Because of = () => expected = + [ Verify.Diagnostic(DiagnosticIds.Maintainability.AccessModifierShouldNotBeUsed) .WithLocation(0) .WithArguments("SpecsClass"), @@ -145,13 +152,13 @@ class SpecsClass Verify.Diagnostic(DiagnosticIds.Maintainability.AccessModifierShouldNotBeUsed) .WithLocation(1) .WithArguments("should_do_something") - }; + ]; - await Verify.VerifyCodeFixAsync(source, expected, fixedSource); + It should_verify = async () => + await Verify.VerifyCodeFixAsync(source, expected, fixedSource); } - [Fact] - public async Task RemovesInnerFieldAndClassAccessModifiers() + public class RemovesInnerFieldAndClassAccessModifiers { const string source = @" using System; @@ -195,8 +202,10 @@ class InnerClass } }"; - var expected = new[] - { + static DiagnosticResult[] expected; + + Because of = () => expected = + [ Verify.Diagnostic(DiagnosticIds.Maintainability.AccessModifierShouldNotBeUsed) .WithLocation(0) .WithArguments("value"), @@ -208,13 +217,13 @@ class InnerClass Verify.Diagnostic(DiagnosticIds.Maintainability.AccessModifierShouldNotBeUsed) .WithLocation(2) .WithArguments("context") - }; + ]; - await Verify.VerifyCodeFixAsync(source, expected, fixedSource); + It should_verify = async () => + await Verify.VerifyCodeFixAsync(source, expected, fixedSource); } - [Fact] - public async Task RemovesFieldAccessModifierWithLeadingTrivia() + public class RemovesFieldAccessModifierWithLeadingTrivia { const string source = @" using System; @@ -246,11 +255,11 @@ class SpecsClass } }"; - await Verify.VerifyCodeFixAsync(source, fixedSource); + It should_verify = async () => + await Verify.VerifyCodeFixAsync(source, fixedSource); } - [Fact] - public async Task RemovesMultipleAccessModifiers() + public class RemovesMultipleAccessModifiers { const string source = @" using System; @@ -282,6 +291,7 @@ class SpecsClass } }"; - await Verify.VerifyCodeFixAsync(source, fixedSource); + It should_verify = async () => + await Verify.VerifyCodeFixAsync(source, fixedSource); } } diff --git a/tests/Machine.Specifications.Core.Specs/Fixtures/ExampleFixture.cs b/tests/Machine.Specifications.Core.Specs/Fixtures/ExampleFixture.cs new file mode 100644 index 000000000..a12f8a30a --- /dev/null +++ b/tests/Machine.Specifications.Core.Specs/Fixtures/ExampleFixture.cs @@ -0,0 +1,91 @@ +using System; +using Machine.Specifications; + +namespace Example +{ + public class Account + { + public decimal Balance { get; set; } + + public void Transfer(decimal amount, Account toAccount) + { + if (amount > Balance) + throw new Exception(String.Format("Cannot transfer ${ 0 }.The available balance is ${ 1}.", amount, Balance)); + + Balance -= amount; + toAccount.Balance += amount; + } + } + + public class TestAssemblyContext : IAssemblyContext + { + public static bool OnAssemblyStartRun; + + public static bool OnAssemblyCompleteRun; + + public void OnAssemblyStart() + { + OnAssemblyStartRun = true; + } + + public void OnAssemblyComplete() + { + OnAssemblyCompleteRun = true; + } + } + + [Subject(typeof(Account), "Funds transfer")] + public class when_transferring_between_two_accounts : AccountSpecs + { + Establish context = () => + { + fromAccount = new Account { Balance = 1m }; + toAccount = new Account { Balance = 1m }; + }; + + Because of = () => + fromAccount.Transfer(1m, toAccount); + + It should_debit_the_from_account_by_the_amount_transferred = () => + fromAccount.Balance.ShouldEqual(0m); + + It should_credit_the_to_account_by_the_amount_transferred = () => + toAccount.Balance.ShouldEqual(2m); + } + + [Subject(typeof(Account), "Funds transfer")] + [Tags("failure")] + public class when_transferring_an_amount_larger_than_the_balance_of_the_from_account : AccountSpecs + { + static Exception exception; + + Establish context = () => + { + fromAccount = new Account { Balance = 1m }; + toAccount = new Account { Balance = 1m }; + }; + + Because of = () => + exception = Catch.Exception(() => fromAccount.Transfer(2m, toAccount)); + + It should_not_allow_the_transfer = () => + exception.ShouldBeOfExactType(); + } + + public abstract class AccountSpecs + { + protected static Account fromAccount; + + protected static Account toAccount; + } + + [Subject("Recent Account Activity Summary page")] + public class when_a_customer_first_views_the_account_summary_page + { + It should_display_all_account_transactions_for_the_past_thirty_days; + + It should_display_debit_amounts_in_red_text; + + It should_display_deposit_amounts_in_black_text; + } +} diff --git a/tests/Machine.Specifications.Core.Specs/Fixtures/FailingFixture.cs b/tests/Machine.Specifications.Core.Specs/Fixtures/FailingFixture.cs new file mode 100644 index 000000000..92b7a74d7 --- /dev/null +++ b/tests/Machine.Specifications.Core.Specs/Fixtures/FailingFixture.cs @@ -0,0 +1,35 @@ +using System; +using Machine.Specifications; + +namespace Example.Failing +{ + [Subject("Scott Bellware")] + public class at_any_given_moment + { + It will_fail = () => + throw new Exception("hi scott, love you, miss you."); + } + + [Tags("example")] + public class context_with_multiple_establish_clauses + { + Establish foo = () => { }; + + Establish bar = () => { }; + + It should = () => { }; + } + + [SetupDelegate] + public delegate void Given(); + + [Tags("example")] + public class context_with_multiple_given_clauses + { + Given foo = () => { }; + + Given bar = () => { }; + + It should = () => { }; + } +} diff --git a/tests/Machine.Specifications.Core.Specs/Fixtures/LargeFixture.cs b/tests/Machine.Specifications.Core.Specs/Fixtures/LargeFixture.cs new file mode 100644 index 000000000..1d2bf0ef2 --- /dev/null +++ b/tests/Machine.Specifications.Core.Specs/Fixtures/LargeFixture.cs @@ -0,0 +1,1025 @@ +using System; +using System.Diagnostics; +using System.Reflection; +using System.Threading.Tasks; +using Machine.Specifications; + +namespace Example.Large +{ + public class when_there_are_many_contexts + { + public static bool Created = false; + + public when_there_are_many_contexts() + { + Created = true; + } + + It spec = () => { }; + } + + public static class OtherTests + { + public static bool Created = false; + } + + class when_there_are_many_contexts_1 + { + when_there_are_many_contexts_1() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_2 + { + when_there_are_many_contexts_2() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_3 + { + when_there_are_many_contexts_3() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_4 + { + when_there_are_many_contexts_4() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_5 + { + when_there_are_many_contexts_5() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_6 + { + when_there_are_many_contexts_6() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_7 + { + when_there_are_many_contexts_7() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_8 + { + when_there_are_many_contexts_8() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_9 + { + when_there_are_many_contexts_9() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_10 + { + when_there_are_many_contexts_10() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_11 + { + when_there_are_many_contexts_11() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_12 + { + when_there_are_many_contexts_12() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_13 + { + when_there_are_many_contexts_13() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_14 + { + when_there_are_many_contexts_14() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_15 + { + when_there_are_many_contexts_15() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_16 + { + when_there_are_many_contexts_16() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_17 + { + when_there_are_many_contexts_17() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_18 + { + when_there_are_many_contexts_18() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_19 + { + when_there_are_many_contexts_19() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_20 + { + when_there_are_many_contexts_20() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_21 + { + when_there_are_many_contexts_21() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_22 + { + when_there_are_many_contexts_22() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_23 + { + when_there_are_many_contexts_23() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_24 + { + when_there_are_many_contexts_24() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_25 + { + when_there_are_many_contexts_25() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_26 + { + when_there_are_many_contexts_26() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_27 + { + when_there_are_many_contexts_27() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_28 + { + when_there_are_many_contexts_28() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_29 + { + when_there_are_many_contexts_29() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_30 + { + when_there_are_many_contexts_30() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_31 + { + when_there_are_many_contexts_31() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_32 + { + when_there_are_many_contexts_32() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_33 + { + when_there_are_many_contexts_33() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_34 + { + when_there_are_many_contexts_34() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_35 + { + when_there_are_many_contexts_35() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_36 + { + when_there_are_many_contexts_36() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_37 + { + when_there_are_many_contexts_37() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_38 + { + when_there_are_many_contexts_38() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_39 + { + when_there_are_many_contexts_39() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_40 + { + when_there_are_many_contexts_40() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_41 + { + when_there_are_many_contexts_41() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_42 + { + when_there_are_many_contexts_42() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_43 + { + when_there_are_many_contexts_43() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_44 + { + when_there_are_many_contexts_44() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_45 + { + when_there_are_many_contexts_45() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_46 + { + when_there_are_many_contexts_46() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_47 + { + when_there_are_many_contexts_47() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_48 + { + when_there_are_many_contexts_48() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_49 + { + when_there_are_many_contexts_49() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_50 + { + when_there_are_many_contexts_50() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_51 + { + when_there_are_many_contexts_51() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_52 + { + when_there_are_many_contexts_52() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_53 + { + when_there_are_many_contexts_53() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_54 + { + when_there_are_many_contexts_54() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_55 + { + when_there_are_many_contexts_55() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_56 + { + when_there_are_many_contexts_56() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_57 + { + when_there_are_many_contexts_57() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_58 + { + when_there_are_many_contexts_58() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_59 + { + when_there_are_many_contexts_59() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_60 + { + when_there_are_many_contexts_60() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_61 + { + when_there_are_many_contexts_61() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_62 + { + when_there_are_many_contexts_62() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_63 + { + when_there_are_many_contexts_63() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_64 + { + when_there_are_many_contexts_64() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_65 + { + when_there_are_many_contexts_65() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_66 + { + when_there_are_many_contexts_66() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_67 + { + when_there_are_many_contexts_67() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_68 + { + when_there_are_many_contexts_68() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_69 + { + when_there_are_many_contexts_69() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_70 + { + when_there_are_many_contexts_70() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_71 + { + when_there_are_many_contexts_71() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_72 + { + when_there_are_many_contexts_72() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_73 + { + when_there_are_many_contexts_73() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_74 + { + when_there_are_many_contexts_74() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_75 + { + when_there_are_many_contexts_75() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_76 + { + when_there_are_many_contexts_76() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_77 + { + when_there_are_many_contexts_77() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_78 + { + when_there_are_many_contexts_78() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_79 + { + when_there_are_many_contexts_79() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_80 + { + when_there_are_many_contexts_80() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_81 + { + when_there_are_many_contexts_81() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_82 + { + when_there_are_many_contexts_82() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_83 + { + when_there_are_many_contexts_83() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_84 + { + when_there_are_many_contexts_84() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_85 + { + when_there_are_many_contexts_85() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_86 + { + when_there_are_many_contexts_86() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_87 + { + when_there_are_many_contexts_87() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_88 + { + when_there_are_many_contexts_88() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_89 + { + when_there_are_many_contexts_89() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_90 + { + when_there_are_many_contexts_90() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_91 + { + when_there_are_many_contexts_91() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_92 + { + when_there_are_many_contexts_92() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_93 + { + when_there_are_many_contexts_93() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_94 + { + when_there_are_many_contexts_94() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_95 + { + when_there_are_many_contexts_95() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_96 + { + when_there_are_many_contexts_96() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_97 + { + when_there_are_many_contexts_97() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_98 + { + when_there_are_many_contexts_98() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_99 + { + when_there_are_many_contexts_99() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } + + class when_there_are_many_contexts_100 + { + when_there_are_many_contexts_100() + { + OtherTests.Created = true; + } + + It spec = () => { }; + } +} diff --git a/tests/Machine.Specifications.Core.Specs/Fixtures/RandomFixture.cs b/tests/Machine.Specifications.Core.Specs/Fixtures/RandomFixture.cs new file mode 100644 index 000000000..1545c2aac --- /dev/null +++ b/tests/Machine.Specifications.Core.Specs/Fixtures/RandomFixture.cs @@ -0,0 +1,1158 @@ +using System; +using System.Reflection; +using System.Threading.Tasks; +using Machine.Specifications; + +namespace Example.Random +{ + public class TestAssemblyContext : IAssemblyContext + { + public static bool OnAssemblyStartRun; + + public static bool OnAssemblyCompleteRun; + + public void OnAssemblyStart() + { + OnAssemblyStartRun = true; + } + + public void OnAssemblyComplete() + { + OnAssemblyCompleteRun = true; + } + } + + public static class StaticContainer + { + static readonly bool Foo; + + static StaticContainer() + { + Foo = true; + } + + public class when_a_context_is_nested_inside_a_static_class + { + It should_be_run = () => + Foo.ShouldBeTrue(); + } + } + + public class NonStaticContainer + { + static readonly bool Bar; + + static NonStaticContainer() + { + Bar = true; + } + + public static class StaticContainer + { + static readonly bool Foo; + + static StaticContainer() + { + Foo = true; + } + + public class when_a_context_is_nested_inside_a_static_class_that_is_nested_inside_a_class + { + It should_be_run = () => + { + Foo.ShouldBeTrue(); + Bar.ShouldBeTrue(); + }; + } + } + } + + public static class tag + { + public const string example = "example"; + + public const string some_other_tag = "some other tag"; + + public const string one_more_tag = "one more tag"; + } + + [SetupForEachSpecification, Tags(tag.example)] + public class context_with_multiple_specifications_and_setup_for_each + { + public static int establish_run_count; + + public static int because_clause_run_count; + + Establish context = () => + establish_run_count++; + + Because of = () => + because_clause_run_count++; + + It spec1 = () => { }; + + It spec2 = () => { }; + } + + [Tags(tag.example, "foobar")] + public class context_with_multiple_specifications + { + public static int establish_run_count; + + public static int because_clause_run_count; + + Establish context = () => + establish_run_count++; + + Because of = () => + because_clause_run_count++; + + It spec1 = () => { }; + + It spec2 = () => { }; + } + + [Tags(tag.example, tag.example)] + [Tags(tag.example)] + public class context_with_duplicate_tags + { + It bla_bla = () => { }; + } + + [Tags(tag.example, tag.some_other_tag, tag.one_more_tag)] + public class context_with_tags + { + It bla_bla = () => { }; + } + + public class context_with_unimplemented_specs + { + It should_be_unimplemented; + } + + [Ignore("example reason")] + public class context_with_ignore : context_with_no_specs + { + public static bool ignored_spec_ran; + + It should_be_ignored = () => + ignored_spec_ran = true; + } + + public class context_with_ignore_on_one_spec : context_with_no_specs + { + public static bool ignored_spec_ran; + + [Ignore("example reason")] + It should_be_ignored = () => + ignored_spec_ran = true; + } + + [Ignore("example reason")] + public class context_with_ignore_and_reason : context_with_no_specs + { + public static bool ignored_spec_ran; + + It should_be_ignored = () => + ignored_spec_ran = true; + } + + public class context_with_ignore_and_reason_on_one_spec : context_with_no_specs + { + public static bool ignored_spec_ran; + + [Ignore("example reason")] + It should_be_ignored = () => + ignored_spec_ran = true; + } + + [Tags(tag.example)] + public class context_with_no_specs + { + public static bool context_established; + + public static bool cleanup_occurred; + + Establish context = () => + context_established = true; + + Cleanup after_each = () => + cleanup_occurred = true; + } + + [Subject(typeof(int), "Some description")] + [Tags(tag.example)] + public class context_with_subject + { + } + + public class context_with_parent_with_subject : context_with_subject + { + } + + [Subject(typeof(int), "Parent description")] + public class parent_context + { + It should_be_able_to_assert_something = () => + true.ShouldBeTrue(); + + public class nested_context + { + It should_be_able_to_assert_something_else = () => + false.ShouldBeFalse(); + } + + public class nested_context_inheriting_another_concern : context_with_subject + { + It should_be_able_to_assert_something_else = () => + false.ShouldBeFalse(); + } + + [Subject(typeof(int), "Nested description")] + public class nested_context_inheriting_and_owning_a_concern : context_with_subject + { + It should_be_able_to_assert_something_else = () => + false.ShouldBeFalse(); + } + } + + public class parent_context_without_concern + { + It should_be_able_to_assert_something = () => + true.ShouldBeTrue(); + + public class nested_context + { + It should_be_able_to_assert_something_else = () => + false.ShouldBeFalse(); + } + } + + public class parent_context_that_has_its_own_because_block + { + Because of = () => { }; + + public class nested_context_that_has_a_because_block_which + { + Because of = () => { }; + } + } + + [Tags(tag.example)] + public class context_with_failing_specs + { + It should = () => + throw new InvalidOperationException("something went wrong"); + } + + [Tags(tag.example)] + public class context_with_failing_establish + { + Establish context = () => + throw new InvalidOperationException("something went wrong"); + + It should = () => { }; + } + + [Tags(tag.example)] + public class context_with_failing_because + { + Because of = () => + throw new InvalidOperationException("something went wrong"); + + It should = () => { }; + } + + [Tags(tag.example)] + public class context_with_failing_cleanup + { + public static readonly Exception ExceptionThrownByCleanup = new InvalidOperationException("something went wrong"); + + It should = () => { }; + + Cleanup after = () => + { + throw ExceptionThrownByCleanup; + }; + } + + [Tags(tag.example)] + public class context_with_console_output + { + Establish context = () => + Console.Out.WriteLine("Console.Out message in establish"); + + Because of = () => + Console.Out.WriteLine("Console.Out message in because"); + + Cleanup after = () => + Console.Out.WriteLine("Console.Out message in cleanup"); + + It should_log_messages = () => + Console.Out.WriteLine("Console.Out message in spec"); + + It should_log_messages_also_for_the_nth_spec = () => + Console.Out.WriteLine("Console.Out message in nth spec"); + } + + [Tags(tag.example)] + public class context_with_console_error_output + { + Establish context = () => + Console.Error.WriteLine("Console.Error message in establish"); + + Because of = () => + Console.Error.WriteLine("Console.Error message in because"); + + Cleanup after = () => + Console.Error.WriteLine("Console.Error message in cleanup"); + + It should_log_messages = () => + Console.Error.WriteLine("Console.Error message in spec"); + + It should_log_messages_also_for_the_nth_spec = () => + Console.Error.WriteLine("Console.Error message in nth spec"); + } + + [Tags(tag.example)] + public class context_with_debug_output + { + Establish context = () => + Console.WriteLine("Debug.WriteLine message in establish"); + + Because of = () => + Console.WriteLine("Debug.WriteLine message in because"); + + Cleanup after = () => + Console.WriteLine("Debug.WriteLine message in cleanup"); + + It should_log_messages = () => + Console.WriteLine("Debug.WriteLine message in spec"); + + It should_log_messages_also_for_the_nth_spec = () => + Console.WriteLine("Debug.WriteLine message in nth spec"); + } + + [SetupForEachSpecification, Tags(tag.example)] + public class context_with_console_output_and_setup_for_each + { + Establish context = () => + Console.Out.WriteLine("Console.Out message in establish"); + + Because of = () => + Console.Out.WriteLine("Console.Out message in because"); + + Cleanup after = () => + Console.Out.WriteLine("Console.Out message in cleanup"); + + It should_log_messages = () => + Console.Out.WriteLine("Console.Out message in spec"); + + It should_log_messages_also_for_the_nth_spec = () => + Console.Out.WriteLine("Console.Out message in nth spec"); + } + + [Tags(tag.example)] + public class context_with_inner_exception + { + It should_throw = () => + { + try + { + throw new Exception("INNER123"); + } + catch (Exception err) + { + throw new TargetInvocationException(err); + } + }; + } + + public class Container + { + [Tags(tag.example)] + public class nested_context + { + It should_be_run = () => { }; + } + } + + [Tags(tag.example)] + public class context_with_public_It_field + { + public It should; + } + + [Tags(tag.example)] + public class context_with_protected_It_field + { + protected It should; + } + + [Tags(tag.example)] + public class context_with_internal_It_field + { + internal It should; + } + + [Tags(tag.example)] + public class context_with_public_Behaves_like_field + { + public Behaves_like behavior; + } + + [Tags(tag.example)] + public class context_with_nonprivate_framework_fields + { + public Establish establish; + + public Because because; + + public Cleanup cleanup; + + internal Behaves_like behavior; + + protected It specification; + + It private_specification; + } + + [Tags(tag.example)] + public class generic_container + { + public class nested_context + { + } + + public class nested_generic_context + { + public class nested_nested_non_generic + { + } + + public class nested_nested_generic + { + } + } + } + + [Tags(tag.example, "behavior usage")] + public class context_with_behaviors + { + public static bool local_spec_ran; + + It should_run = () => local_spec_ran = true; + + Behaves_like behavior; + } + + [Tags(tag.example, "behavior usage")] + public class second_context_with_behaviors + { + Behaves_like behavior; + } + + [Tags(tag.example)] + public class context_with_behaviors_where_the_behavior_field_is_ignored + { + public static bool local_spec_ran; + + It should_run = () => + local_spec_ran = true; + + [Ignore("example reason")] + Behaves_like behavior; + } + + [Tags(tag.example)] + public class context_with_behaviors_where_the_behavior_is_ignored + { + public static bool local_spec_ran; + + It should_run = () => + local_spec_ran = true; + + Behaves_like behavior; + } + + [Tags(tag.example)] + public class context_with_behaviors_where_the_behavior_specs_are_ignored + { + public static bool local_spec_ran; + + It should_run = () => + local_spec_ran = true; + + Behaves_like behavior; + } + + [Tags(tag.example)] + public class context_with_nested_behaviors + { + public static bool local_spec_ran; + + It should_run = () => + local_spec_ran = true; + + Behaves_like behavior_with_nested_behavior; + } + + [Tags(tag.example)] + public class context_with_behaviors_without_behaviors_attribute + { + public static bool local_spec_ran; + + It should_run = () => + local_spec_ran = true; + + Behaves_like behavior_without_behavior_attribute; + } + + [Tags(tag.example)] + public class context_with_behaviors_with_establish + { + public static bool local_spec_ran; + + It should_run = () => + local_spec_ran = true; + + Behaves_like behavior_with_establish; + } + + [Tags(tag.example)] + public class context_with_behaviors_with_because + { + public static bool local_spec_ran; + + It should_run = () => + local_spec_ran = true; + + Behaves_like behavior_with_because; + } + + [Tags(tag.example)] + public class context_missing_protected_fields_that_are_in_behaviors + { + public static bool local_spec_ran; + + It should_not_run = () => + local_spec_ran = true; + + Behaves_like behavior_with_protected_fields; + } + + [Tags(tag.example)] + public class context_with_protected_fields_having_different_types_than_in_behaviors + { + public static bool local_spec_ran; + + protected static bool field_that_should_be_copied_over_from_context; + + It should_not_run = () => + local_spec_ran = true; + + Behaves_like behavior_with_protected_fields; + } + + [Behaviors] + public class Behaviors + { + public static bool behavior_spec_ran; + + It should_run_if_behavior_is_not_ignored = () => + behavior_spec_ran = true; + } + + [Ignore("example reason")] + [Behaviors] + public class IgnoredBehaviors + { + public static bool behavior_spec_ran; + + It should_not_run = () => + behavior_spec_ran = true; + } + + [Behaviors] + public class BehaviorsWithIgnoredSpec + { + public static bool behavior_spec_ran; + + [Ignore("example reason")] + It should_not_run = () => + behavior_spec_ran = true; + } + + [Behaviors] + public class BehaviorsWithNestedBehavior + { + Behaves_like disallowed_nested_behavior; + } + + public class BehaviorsWithoutBehaviorsAttribute + { + public static bool behavior_spec_ran; + + It should_not_run = () => + behavior_spec_ran = true; + } + + [Behaviors] + public class BehaviorsWithEstablish + { + Establish context; + } + + [Behaviors] + public class BehaviorsWithBecause + { + Because of; + } + + [Behaviors] + public class BehaviorsWithProtectedFields + { + public static bool behavior_spec_ran; + + protected static int field_that_should_be_copied_over_from_context; + + It should_not_run = () => + behavior_spec_ran = true; + } + + [Subject("Context that inherits")] + [Tags(tag.example)] + public abstract class context_that_inherits + { + public static int base_establish_run_count; + + Establish context = () => + base_establish_run_count++; + + protected It should_be_inherited_but_not_executed = () => { }; + + It should_not_be_executed = () => { }; + } + + public class context_with_inherited_specifications : context_that_inherits + { + public static int because_clause_run_count; + + public static int establish_run_count; + + Establish context = () => + establish_run_count++; + + Because of = () => + because_clause_run_count++; + + It spec1 = () => { }; + + It spec2 = () => { }; + } + + [SetupForEachSpecification] + public class context_with_inherited_specifications_and_setup_for_each : context_that_inherits + { + public static int because_clause_run_count; + + public static int establish_run_count; + + Establish context = () => + establish_run_count++; + + Because of = () => + because_clause_run_count++; + + It spec1 = () => { }; + + It spec2 = () => { }; + } + + [Behaviors] + public class SampleBehaviors + { + It behavior1 = () => { }; + } + + public class context_with_specs_and_behaviors + { + Establish context = () => { }; + + Because of = () => { }; + + Behaves_like behaviors; + + It spec1 = () => { }; + + It spec2 = () => { }; + } + + public class TestCleanupAfterEveryContext : ICleanupAfterEveryContextInAssembly + { + public static bool AfterContextCleanupRun; + + public static int AfterContextCleanupRunCount; + + public void AfterContextCleanup() + { + ++AfterContextCleanupRunCount; + AfterContextCleanupRun = true; + } + + public static void Reset() + { + AfterContextCleanupRun = false; + AfterContextCleanupRunCount = 0; + } + } + + [Tags("foobar")] + public class TaggedCleanup : ICleanupAfterEveryContextInAssembly + { + public static bool AfterContextCleanupRun; + + public static int AfterContextCleanupRunCount; + + public void AfterContextCleanup() + { + ++AfterContextCleanupRunCount; + AfterContextCleanupRun = true; + } + + public static void Reset() + { + AfterContextCleanupRun = false; + AfterContextCleanupRunCount = 0; + } + } + + public class UntaggedCleanup : ICleanupAfterEveryContextInAssembly + { + public static bool AfterContextCleanupRun; + + public static int AfterContextCleanupRunCount; + + public void AfterContextCleanup() + { + ++AfterContextCleanupRunCount; + AfterContextCleanupRun = true; + } + + public static void Reset() + { + AfterContextCleanupRun = false; + AfterContextCleanupRunCount = 0; + } + } + + [Tags("foobar")] + public class TaggedAssemblyContext : IAssemblyContext + { + public static bool OnAssemblyStartRun; + + public static bool OnAssemblyCompleteRun; + + public static void Reset() + { + OnAssemblyStartRun = false; + OnAssemblyCompleteRun = false; + } + + public void OnAssemblyStart() + { + OnAssemblyStartRun = true; + } + + public void OnAssemblyComplete() + { + OnAssemblyCompleteRun = true; + } + } + + public class UntaggedAssemblyContext : IAssemblyContext + { + public static bool OnAssemblyStartRun; + + public static bool OnAssemblyCompleteRun; + + public static void Reset() + { + OnAssemblyStartRun = false; + OnAssemblyCompleteRun = false; + } + + public void OnAssemblyStart() + { + OnAssemblyStartRun = true; + } + + public void OnAssemblyComplete() + { + OnAssemblyCompleteRun = true; + } + } + + [Tags("foobar")] + public class TaggedResultSupplementer : ISupplementSpecificationResults + { + public static bool SupplementResultRun; + + public Result SupplementResult(Result result) + { + SupplementResultRun = true; + return result; + } + + public static void Reset() + { + SupplementResultRun = false; + } + } + + public class UntaggedResultSupplementer : ISupplementSpecificationResults + { + public static bool SupplementResultRun; + + public Result SupplementResult(Result result) + { + SupplementResultRun = true; + return result; + } + + public static void Reset() + { + SupplementResultRun = false; + } + } +} + +namespace Example.Random.Internal +{ + [Subject("Internal types")] + [Tags(tag.example)] + class when_a_context_is_internal + { + It should_work = () => + true.ShouldBeTrue(); + } + + [Subject("Internal types")] + [Tags(tag.example)] + class when_a_context_is_internal_and_uses_internal_behaviors + { + protected static bool MSpecRocks = true; + + Because of = () => + MSpecRocks = true; + + Behaves_like a_working_spec; + } + + [Behaviors] + class WorkingSpecs + { + protected static bool MSpecRocks; + + It should_work = () => + MSpecRocks.ShouldBeTrue(); + } +} + +namespace Example.Random.SingleContextInThisNamespace +{ + public class context_without_any_other_in_the_same_namespace + { + Establish context = () => { }; + + Because of = () => { }; + + It spec1 = () => { }; + + It spec2 = () => { }; + } +} + +namespace Machine.Specifications +{ + namespace ExampleA + { + namespace ExampleB + { + public class InExampleB_1 + { + It is_spec_1 = () => { }; + } + + public class InExampleB_2 + { + It is_spec_1 = () => { }; + } + } + + public class InExampleA_1 + { + It is_spec_1 = () => { }; + } + + public class InExampleA_2 + { + It is_spec_1 = () => { }; + } + } + + namespace ExampleC + { + public class InExampleC_1 + { + It is_spec_1 = () => { }; + + It is_spec_2 = () => { }; + } + + public class InExampleC_2 + { + } + } + + public class ContextWithSpecificationExpectingThrowThatDoesnt + { + public static bool it_invoked; + + static Exception exception; + + Because of = () => + exception = null; + + It should_throw_but_it_wont = () => + exception.ShouldNotBeNull(); + + public static void Reset() + { + it_invoked = false; + } + } + + public class ContextWithThrowingWhenAndPassingSpecification + { + public static bool it_invoked; + + Because of = () => + throw new Exception(); + + It should_fail = () => + it_invoked = true; + + public static void Reset() + { + it_invoked = false; + } + } + + public class ContextWithEmptyWhen + { + public static bool it_invoked; + + Because of; + + It should_do_stuff = () => + it_invoked = true; + + public static void Reset() + { + it_invoked = false; + } + } + + public class ContextWithTwoWhens + { + public static bool when_1_invoked; + + public static bool when_2_invoked; + + public static bool it_for_when_1_invoked; + + public static bool it_for_when_2_invoked; + + Because _1 = () => + when_1_invoked = true; + + It for_when_1 = () => + it_for_when_1_invoked = true; + + Because _2 = () => + when_2_invoked = true; + + It for_when_2 = () => + it_for_when_2_invoked = true; + + public static void Reset() + { + when_1_invoked = false; + when_2_invoked = false; + it_for_when_1_invoked = false; + it_for_when_2_invoked = false; + } + } + + public class ContextWithEmptySpecification + { + public static bool when_invoked; + + Because of = () => + when_invoked = true; + + It should_do_stuff; + + public static void Reset() + { + when_invoked = false; + } + } + + public class ContextWithThrowingSpecification + { + public static bool when_invoked; + public static bool it_invoked; + public static Exception exception; + + Because it_happens = () => + { + when_invoked = true; + exception = Catch.Exception(() => { throw new Exception(); }); + }; + + It should_throw_an_exception = () => + it_invoked = true; + + public static void Reset() + { + when_invoked = false; + it_invoked = false; + } + } + + public class ContextWithSingleSpecification + { + public static bool because_invoked; + + public static bool it_invoked; + + public static bool context_invoked; + + public static bool cleanup_invoked; + + Establish context = () => + context_invoked = true; + + Because of = () => + because_invoked = true; + + It is_a_specification = () => + it_invoked = true; + + Cleanup after = () => + cleanup_invoked = true; + + public static void Reset() + { + because_invoked = false; + it_invoked = false; + context_invoked = false; + cleanup_invoked = false; + } + } + + public class AsyncSpecifications + { + public static bool establish_invoked; + + public static bool because_invoked; + + public static bool async_it_invoked; + + public static bool sync_it_invoked; + + public static bool cleanup_invoked; + + Establish context = async () => + { + establish_invoked = true; + + await Task.Delay(10); + }; + + Because of = async () => + { + because_invoked = true; + + await Task.Delay(10); + }; + + It should_invoke_sync = () => + sync_it_invoked = true; + + It should_invoke_async = async () => + { + async_it_invoked = true; + + await Task.Delay(10); + }; + + Cleanup after = async () => + { + cleanup_invoked = true; + + await Task.Delay(10); + }; + } + + public class AsyncSpecificationsValueTask + { + public static int establish_value; + + public static int because_value; + + public static int async_it_value; + + public static int sync_it_value; + + public static int cleanup_value; + + public static ValueTask Test() + { + return new ValueTask(10); + } + + Establish context = async () => + establish_value = await Test(); + + Because of = async () => + because_value = await Test(); + + It should_invoke_sync = () => + sync_it_value = Test().Result; + + It should_invoke_async = async () => + async_it_value = await Test(); + + Cleanup after = async () => + cleanup_value = await Test(); + } +} + +namespace Example.Exceptions +{ + + public class AsyncSpecificationsWithExceptions + { + Because of = async () => + throw new InvalidOperationException("something went wrong"); + + It should_invoke_sync = () => + throw new InvalidOperationException("something went wrong"); + + It should_invoke_async = async () => + throw new InvalidOperationException("something went wrong"); + } +} diff --git a/tests/Machine.Specifications.Core.Specs/Machine.Specifications.Core.Specs.csproj b/tests/Machine.Specifications.Core.Specs/Machine.Specifications.Core.Specs.csproj index 4c9f5092f..6e8313733 100644 --- a/tests/Machine.Specifications.Core.Specs/Machine.Specifications.Core.Specs.csproj +++ b/tests/Machine.Specifications.Core.Specs/Machine.Specifications.Core.Specs.csproj @@ -6,13 +6,8 @@ - - - - - - - + + diff --git a/tests/Machine.Specifications.Fakes.Specs/Machine.Specifications.Fakes.Specs.csproj b/tests/Machine.Specifications.Fakes.Specs/Machine.Specifications.Fakes.Specs.csproj index 96a11b590..96931d882 100644 --- a/tests/Machine.Specifications.Fakes.Specs/Machine.Specifications.Fakes.Specs.csproj +++ b/tests/Machine.Specifications.Fakes.Specs/Machine.Specifications.Fakes.Specs.csproj @@ -6,13 +6,9 @@ - - - - - - - + + + diff --git a/tests/Machine.Specifications.Should.Specs/Machine.Specifications.Should.Specs.csproj b/tests/Machine.Specifications.Should.Specs/Machine.Specifications.Should.Specs.csproj index 5503a8041..6e8313733 100644 --- a/tests/Machine.Specifications.Should.Specs/Machine.Specifications.Should.Specs.csproj +++ b/tests/Machine.Specifications.Should.Specs/Machine.Specifications.Should.Specs.csproj @@ -6,12 +6,8 @@ - - - - - - + + From b9d68693609796122f91cf681d4c29930d78cac4 Mon Sep 17 00:00:00 2001 From: Robert Coltheart Date: Wed, 23 Sep 2026 20:54:10 +1000 Subject: [PATCH 03/10] final tidying --- AGENTS.md | 37 +++++++++++++++++++++++++++++++++++++ Directory.Build.props | 6 +++--- assets/mspec_logo.png | Bin 0 -> 5930 bytes assets/mspec_logo.svg | 27 +++++++++++++++++++++++++++ build/build.cs | 4 ++-- docs/.gitkeep | 0 6 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 AGENTS.md create mode 100644 assets/mspec_logo.png create mode 100644 assets/mspec_logo.svg create mode 100644 docs/.gitkeep diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..83f7d3bcc --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,37 @@ +# Machine.Specificaitons Agent Guide +**Machine.Specifications** is also known colloquially as **MSpec**. + +## Project architecture +All code for MSpec lives in `src` or `tests`. Documentation is in `docs`, and logos for NuGet are in `assets`. + +The below projects are in use by this project. You should **ignore** any other project that is not in this list. + +- `Machine.Specifications` - Meta NuGet package that references the default set of dependencies +- `Machine.Specifications.Analyzers` - Code hints and fixes for writing tests "the MSpec way" +- `Machine.Specifications.Core` - Core testing engine and framwork +- `Machine.Specifications.Core.SourceGenerator` - Source generators to aid in test discovery and speed up execution +- `Machine.Specifications.Fakes` - Interface mocking library used by MSpec +- `Machine.Specifications.Fakes.Analyzers` - Code warnings and fixes for writing mocks using MSpec +- `Machine.Specifications.Fakes.SourceGenerator` - Source generator that creates code for mocks in MSpec +- `Machine.Specifications.Should` - Assertion library for MSpec +- `Machine.Specifications.Templates` - Dotnet 'new' templates for creating test projects using MSpec + +All test projects end in `.Specs`, and match the libraries above. + +**Important:** Any projects named with the words `Fixtures` or `Runner` should be ignored as these are legacy and will be removed. +Only use the projects referenced by the `.slnx` file in the repo root. + +## Dev environment tips +- Use `dotnet build` to build the solution +- Use `dotnet test` to build and run all the tests in the solution + +## Making changes +- Make the smallest, most surgical change you can make for the feature you are writing +- Tests should be focused and not verbose +- Follow the naming and styling conventions of this repository +- All changes, in general, should have accompanying tests +- Any API surface changes should have documentation added to `docs` + +## PR instructions +- Title format: Use with a brief description +- Always run `dotnet test` before committing. diff --git a/Directory.Build.props b/Directory.Build.props index bb9a87f75..1ebe88e62 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -11,7 +11,7 @@ <Authors>Machine Specifications</Authors> <PackageTags>test;unit;testing;context;specification;bdd;tdd;mspec</PackageTags> <PackageReleaseNotes>https://github.com/machine/machine.specifications/releases</PackageReleaseNotes> - <PackageIcon>icon.png</PackageIcon> + <PackageIcon>mspec_logo.png</PackageIcon> <PackageProjectUrl>http://github.com/machine/machine.specifications</PackageProjectUrl> <RepositoryUrl>http://github.com/machine/machine.specifications</RepositoryUrl> <RepositoryType>git</RepositoryType> @@ -20,8 +20,8 @@ </PropertyGroup> <ItemGroup> - <None Include="../../images/icon.png" Pack="true" PackagePath="" Visible="false" /> - <None Include="../../README.md" Pack="true" PackagePath="/" /> + <None Include="$(MSBuildThisFileDirectory)assets/mspec_logo.png" Pack="true" PackagePath="/" Visible="false" /> + <None Include="$(MSBuildThisFileDirectory)README.md" Pack="true" PackagePath="/" /> </ItemGroup> </Project> diff --git a/assets/mspec_logo.png b/assets/mspec_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..41082cd303c6db99c8a85ae98afc3208034eb169 GIT binary patch literal 5930 zcmV+_7uD#AP)<h;3K|Lk000e1NJLTq004jh004jp1^@s6!#-il00009a7bBm000Bg z000Bg0ho%3v;Y7A8FWQhbW?9;ba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ@H17Pm=6 zK~#90?VV|GRM(Y&zx%qiAazSZLZA(UgoH3&kc8t@V#kKy*iL1t?3pUOKm-z-9a2n^ zN+p>}T*1UunM`GzNri;51x7+FwxdZh$)qN>$Hu}Ii4$WjEH;afgpgVS3y{>UwY%S) zA3};)v~<7wUblen7j(aO?or?K?z{KgbI%b{N^USjY3aU9AHIbMGSRiU2yO$JEFnn< zl8{6LkwEO_dwPID1pQKSLBIt8=cN>9(ex(i*BT-;?UUl-6^+0R^@EA2ZU8Tpm#5o& z+I>RE`+(0#xD#-i)SMeQ0`fyC#6i0rad6F=r(7nrWeHQx0LseBq6e@qu}S%5DR~sZ z{7~v6;RJ#|3CSD%p3cfmn>G!EQlCJX5(ZFFQ4!hc>3bL{o<Q&z5Ep8l#-I!Mz0}38 z@%O&9VZ#P*s1=%sur`2~%l74H(zg~w5il#%`UJ>10k2C<FIm5O^|4SZGZtZK03|zj z-!BB;1HJ-?Q0rqDDGutI{I_R{3jau$O(Mg|0L1p4<&Pt@AA-yawK67AEs#H2SG?*E zgoz=9g#m2eS^i~&_5#Soq1MF;1RRp^-1_3eH$$#VC=Foe&ONz)O}>caD<M-Nw7jk9 zd~5C6!lR*5AS4D*Qc@Bl>@hDO<Ua#;%M}POyug2W9MR8zYx(j%s~fl60JfKwKO_+^ z3&^sx;qa$kz%%QL3-?>usAUFFR#q16mD=+lz5{5MG&=Q=61L;*`__gH8+xs1&=LdK zv7`KMX%qW^J4|ov#^4B={<IbT1Jj?x9i@AomNxNcZgqYj+=Z@vSW;TP+U$l*8v!aR zDr}c}`u|->zG+GWHwgk>Y;A7%?&i&#byMV<VE~tX_q#znp<H-?w6(ctbF~I_Z)#dP zsi|p-H3|mty9nW1QB+jauUxWf1K75$!VwWO@EfFjSgGJ3si{7Mt2H<SNK4NkzaVUU zQ}6aiYL9PPxw2cOP^EK#9Xno~6)~;<K)7^1KzCPHNbWU(rO|_O|4X}f&r~T?nE||1 zRyJ4Kd{sb!Dw#&{`~CFv^aOo>Pmc$m&#zD;qsYZJpR9VRtZc3-iAoHhw6ru?leRa2 zY!&iU;qLCn$SY1tiQ64kqW~asY|{4jwz9Gm719hFz}CHc<9yiP5Rj`vA(eD@bsCq^ zt@M?vig^*b?ai{XvIL`o3>iR0MMY%vp#EQk(Xc<7E(M*Z!iY>kaJN_5e!F$+)+i%l zf;NCHTefIjp8h?+my9T2CMqUzVKx!Gnx)aP39nUDRM>(Q5VQfL&dGXF!t!A6H=CjN zw}KJC?M6ydd@yPdJl^T)|8cOl2W0>yWxH3X_VBg2TDf@fqB40s9uI!M@fp1C_tWDE zekE}=7cXAK6{KTo9KN%owEVGPZVcD}cI+s>TS&GC)7V(JT&>hpSM!&H?{n<v5p>=7 z6W7(PZs_h-AWKTgsgo!8;Llamd~}GGvu71(Hi7{0N@;27>_Be}$N<X9%A%!B>;Yl| zZD=f9u2yQRt4D^}rp5-|f3K3RPGdj1%6GR>S?=y`s@|{U<cZ@W%hI~qYNbXXA<2im zqNJoGB9Qw6G61jCehS<bkY?l1($Ye0^+(sdV?Ay+2dfTHf9hnw@890u9-0~(Xlqk< zV8_+wqN%Bo-rm5r=%v)DKXsD#->am%>)QFq;kp`HTa=CjpA`|&F9dSKr1t{0mzF;S z;w=<~X}7eraJaU5LPt$P!gLnp=i_jUecEeapdVLjD=jU}*ZrYY5*Hsw#_ZcjOG_sz zDtgT8JRUc7H8pg0UK&@P5Q0T{`J`tAJbI6X1eUHZE<7-qizj6OB_$;>B4XNMV4gwc zfNO{SiLhxJIk^kSnwO0bf44t(cNa}fO|+hE#;;)B5D1#4F)Jm7ta&*kB>deUBc<eQ z^BF!qb~K<#=%V}rGSnHt$I{!EH<^=3lM2Wb_LvtyhNSZW{JPHZPd=u-y^Xy50;H6j zJaL@%wl+hqUL)wbPMga`o6E(F8ObcX;|}ch2<qx;xX{rNu)M>yH2|uNV4-G@{wDC# zi7uRQ1lX}-_wCX~9T3pu;(APW*dGs@&4#Y)A?x_D5JI47nxUnq;@3g1rrQ>-UAyAU zco$7P3Do!*3Oe8AYUOZkjp2^-`~6|p`7ku}8}&O#DXFWip+(KaFh<w(f1l{0aYulm z6FcI6jcO9iuzxcngy8PHd?l{~UDF<VX7$Q<#`=D|5kMfs7NZKZxmvHg)VsylNGUm7 zTN89B+h{ah|IxVLkM+g&o#l@MpE0Vyv}wwGMmH5w%5j&O0r2@9WqZCb)|X?C07Cnr ziq;dRPbYI;SjCA<3Fc+zkeHODM3#i-#`^BM1~BCGQFlZ;H+KQfxNuGC5q>zFPI7V= zs1qpV!`sXDUUxLVt^o)szOAnHA*V@R-eNTE)`_r*5JDp_zW|%+-%8iNf4z^dY31dz zeK}I_h}zbNT&Owo!!Bwp?8uovpZIvgkzUs#c&udCu4|lm*BF2%{p&C(Ez7*@>?_=+ zx44q{_yn?ZOiOwu@QXE9e|Uufl$4Z22v}vB20~*|{$ey+&=E{GESjdVD8Jx}y$<DV z2(jks?cyu;0%YX0N2Nqbxbavx91e1GZ|9Sbtxbv%8yibzRwgO4Qb?MSgwx?5GBOf? z!NEb?9uFO#c5v=oJB^Kv^z>MAI(vi#w=cx$G%LU55E4>kWXv+)jp5I(FaRON6ISFd z%9=Ni^XJ=x+B69Sr_)JZULN`Rd8DSMPWtJRQsQ#CsI9G~wx$lZ$8D;fiHV8K&9o+8 zhK78SQ3f#L3LZ+}U^|CJNf<qDHwP-sNrsV_n8?zlODQPG$7b+#<Ma8b{-~OFD=WEl zY5cwYV0m!K7jc;U^pB!5!4W-c`SRt1Flq!Cz`jI7TDDkkZ*NmBGa@2_B}*RUfd?NX z!mcLuklk+Q-p}4k{^9}-R36|!WhGvpPl@bd+S}X6w$1<&Iz4?40B^&nNuW*2FI%O- zz`y{f>rW|_nVdX>jT^tlvSrJZb^d4~>~<b{Xc?O}ZDQ6ewMk1)pFYLFfbx^yV<Hfb z4*z?^03_BK!0Gx^_!K@xx$|?`v}qHmsj13jj>XJbGugQDYvknQD3j^)`e-<PTA93w zkTBBM8Vsde2chmS8V9e}OY@m=V-y17?z`?{)#}2L8NC%mMMY6mw3@r_R2Cmg^O;5l z2M3kOn}CHSC3{lgvH{rr+;3IOXPO%E`_(-C+1c4V@#GVRCwjqPv)Ooh#Z%-e@^1Qk ze$F&CDv>oAgq_dB$SXj6-l~RGJ^eG2lUcQ@5W5NQ`^lnd8Y@;l&5Ri{l*l{Ve8#$H zr=bEHBXa=5`~H*R(@)RS*Js?p5@ENqV&zIphyAgLii%?8iWN!>v9GVsbl=DbQrrum zZP~I#lL`-ej7PA!dah>a7nhQf5<cYvQqxj-;DHB}$a1x|D3LQELf#1oEhA%I7T_?u zJt-yU&$SztlbD#u7Zm;2Dp|U8iIR=3_H*r4h0n#m^2)y3G@ni0ZdMCYN<3~iuGSWg z9;s6@%U!y3sVVDxqYOErmKc`f9USE7k;AxJTkyEurp^g;;ag}Il1wGSbe*1_9=f_Z z>FVsHyQ`D#?k=TCmYfbJ1qJ!a<f-PKdlvKdJMZ9e8{0c*K67SdvMhuk*5M#NK7si7 zcoGt(<BW^PZa2R2kwTkm7gEeY1ZQP!u2$OH+v)D=qNm4W`V2O|ATK0KzR6;@+sRwB zh^ne8Wip3HQIFd_a*$LAL2RspxcGQdQc_4wOAk)CAX6JEsu&!tuGXQU%46<OHB4S! z_*at2%Qs&~DJ34y(5to8K<K!T`W#INlqMcDi`dv$OI*E1Nl!~7Hg>9n!i!{0N~tFH z*km%ZGEI$^QH2nKxpS3FtIS7|q#;NQwH}ipWtORdN=gYQAH}!`k~E~cbT4KyW5$#i zr~pV(<Qles7>%JS+F?&@Z0y7rg$WMFl+iV6${0XYq@jeEmNJEOjk<MI=O#x3EQ>-g z!oc9vsmeZubRC#724E!bztwmYW)?M>0S)Ao(6*!FLa0@kG?wk@8>dH;2z3d1O~i~a za<gb_H@@v{5f?N8Q^H&u8XChgIn>oiDLK>B6lyglg^;pC12H8GptrXdmrGsxSF>no zZMFPdVX#QS1r14aumaN4(n(9tz~OLO;-{~ztuwt1qtw=zucHtGhr>x)dIssiZUqlX zYO<s0O~~LnFEuTFWG~u^fRNgnS{`}i;gCiGkB8UiqwcU;128op1kq$iq9hny(=?n; zCr+nxB)^@Mk{*wTuI?_*G&OR`U_l7C$4zy04foz_Nf2|ue01nT!_hzh(-RY!GdGj? zxOie64%0?gDQMK}*grN!I+uqkr<3&b3}suSm6h)*Kb)xouh&au<$FqG&CSdrJv{@5 z)7)2Ur1T!sii=k?0;bnSn~|(0?&RXdOB|@IR3b|y@4ovkot<hbjLn#ltVGTPbQKpD zw`dGygfKl_M`UCq3Dc)5k#(T*0BvpI;}>XcZRNf9-d7@PdSaqg2VRZ<^73Yo{LqRP z)6+AQ$npAo?A^PMfq~Hb-240c+4t(J%1%3{8Jg8k9sz%a%SXec5C^SjG&L;^A=GR@ zc64;GyL`9OW9EUP>pFY)?c;(XH?<I&Wd<OnJP5<5gY^hY3?M2hnpr98Lc8iupXT+~ zeyyZDT%h><e)hfkDyL4WOLUQvnnGlhHL(O<P5%pAHh?v2o^l~MX+^_XSxO3zjBw=W z5z5MTS^7HY@9$@4X(>mKsGT}xWm%R}`PjyyqIMXaCs4>gS<&+J#6;!EB2S$<#n!FA zq|Igi#L(q(vGtd~<aE8-j2_dcCn}pHPt4!@dejS9SYiMG^B1T;j@Z%B!LPP$<E^*; z53hH^T1f%p9USDXx87pgw*OT2&L2&#%H+@!plh~k^91&LIxC|c30*+E*$N~l&m<{1 znG2tOs#LDe=VSl={Zv<1vt-E<?zv~NVYji*=i|_!LsV8CP`1v$n#80el9DZ1`vY_) z#zc;+S+6J=v%PfpE=)`nJDR^7tm5KDbAvn_PA7Sb7Lk{qM|xUXK#3w-T3e~DsiW?2 zof7x%cqAq!@wxjf%hI!ReR1L1;s0EjDpnW27Me8O02&+WP49ddN=8{#RYg@*6)`a} zWM*cPk}``KGm>yPoFmb@0|Ntidfaq$T%fJJou<a7fUATW;o`*$G@L$7);zTn<m(}& z{`%<uUts`kEg5g7%{kkK#I!?r9*>9P$B&yOeoT6MdpUOO7{`tsv%KxeaN_vKB+pF7 z=`=4_r+{|p8+dp0XIFS-Hg8_yL&|cq6p&J<uI3~35Ukt79bMO{t1(_yZvtMqx|-;< z^#XKl2PS2VK6Ub>X%nd%fv&Dj>Q9;Gj*&KOJFoum8Ut9n_N(=P@+DzccbD??us0$@ z4~hDu)Dr$!T)d*;>d&uVGYDQ(+4#`#R*i0Pf#<2n&}*_rc`<BFi0jr7zODhRD=yp* zRI6(I<nd2%cbgt^aKqs7xH)-3=|uUj>x#a5-Tmq@x8?+L+=`QvrSsAy8XBxignXmW zP=89<QdtPb?8`9?U|sR5-y`^&(Z+ifWCpz%5kk=4uOx;1hwF+8$DGrRzd0{4Ts<@` zEuFlA#meFUZU%;nN2`bp5b!UIv#J}nSJoF7z6ltv9zJ9Q1-Fb~5~!>kF5&gd^SLpZ zutzjqd;<k1h;JFe#Hj3iz^&WlgcV>X?2XHQfuF0;C@n3WMR|EahdRe6#ACCC=b;c7 zN)#EN5Zq>}5Q0VOIv<35{@GQlCQKqYsbACMh<@JT>HjCdaL7t}#%zS9QCnR->7>Xu zO(Q3F0a^31@p`?SI(dRKP2qJ|G(BTBw=Y~sWMmX)o6qpc$44i9Dr)%2Pgm9Xa7+&N zZ=F=zll>8Ql<xkb9I7;><fKAt%USAbC-!|OBur;fem)Mzl~uJo9yh1!>uGH{8!|)C zG>!E146?Fwa5%0^xbE?|sjI1((5pB6<SXoaT?nyctabl2?FaJXZ7(hVIf!ort=d(L zX9PkB=I1V8UUv4l^M<~@KF&6uq2+8deSLkZR2!FR)25N0F`GGa=Mo(~ZOrSW)Hz*W z&&d<V$NU==cRo_eA8%N*>Iaj(KA;zBzo+Ya(T;>Az@k7EyB@=T_|-<>bjGo$pn&+e ziQlKwrcGmh?gHlLE}*01Q`*~HoIih_KE?a_F)=aBoH>h>l+;N_?+Brhoim^0S+l6C zuEy=|9`&92&IkDczW(O}xg($v0ATyBU3Z{se+85!!y6t605a!glbgE$O*6JyIMdX~ z(IbadsK=dm-OU_>XB%~0=fsKQG@h;pFroA55PmIx-MW<ll^hA!006e{EdNJ@_zeon z%(uB(iHe>^VxpSNwJJ-~sx0k#@#01L`}<TM0Fg-X`1&<p{X?KP2KAV&U$g3W0)7_E zy<?G@maeSx0b(5vCA9@Kn~hk9x{5l9iHT;M{`pBToex1806=SV!*?aTKJk^IK?tFw z9D7_`TzF?Gm%Qd`Zg?)(+k-ZM&6_vtc>4;0H-nX7HgWOBBitu55e*^x`+GWzHgDb> zbnt+onbw948@x8@T@K<SBXZ0lF5dVFBo#8uK)@kyU-V;}Hf=I=CeE;9e$ARSZt1l> zD&d4tS*nSPGag~9LWT*P#&7?JjT@JHj0#e+GqYjC(;d3-KMFFeg8t&-;tjpOg%CKy z&H&^oO}8yux9;h4Dx@jfntQgWsA<r~=Rkg-N~Te4HXE_A!O!4Ttt3<-;E>-g?q9oh zg|hPNO7~{JzG~G4Z{M^p5k?b3BNM^6@R|Vb?~BxyJzH3KUZv2W96=LNQBe`u>F(c! z;3?(81Ej6ZMO%=i)l$>aNli^ttWn@d_-&-{uPiDmQW7IJ8dD4aV9S;*TH0+{{|bBu zg&xD33<><i)!gu$k)_^vm}UUOY%eW;2*e&>ij>j{8#;tw^}3=$!y$R&VY&eT?AWn4 zL)!FL0n5%nPiX{y^W%T=*`lH*vzxLcKyTf;l`XF3*-NFATYy`~gT_V*_=OzoyWfh= z2a864(QGf>{UGow;0{Y04u6gaA-+D@NFG&K9-_OxxbT3hd3GK`d=oG?^~ThoS4z1h z!4Z9r)twI^7y(AJbLVSme!M?HP#7{LLdzeeov&{wEDXA4gHb|i0K>ezYwt2m*Ea)S z2(>QOAU_a@A53&;!wSN}0ET(_m0b^Ln)ZF*kx=Vm3WC20*kbn5E)c@X0ET&a=bl9x z^4kbj0O8||4-N^uqYHlVOi|(ggj$)a2}=VQrnIzlwogQ?K+284ZK2jDAOvklSuQoX zeZ%V2VS7G4tPNn8En6z>DRWvL(vVLgc^nAOC=IwIk^e0aue+LOzq5JslJF~Saurj; z07g?$Q4!hIGw`6)c@!ZZ1r~-_rDFo#kjOU@9Mj%gzI^$VD8)O>lrw;<*;ZDT5~17g zL&*D(;$DQj6Z6vDb}>|G<3k~+!e>9IDlj8dOnC#i9xs)Z&9&*;?Pz35w7E!mn}C@} zk`N>TF$|rG8V(zF13sV^$pr)#kerj6IE$oF3L5Qx?Gu%O7~#VI1N5HtvC`!~5&!@I M07*qoM6N<$f^MsIfdBvi literal 0 HcmV?d00001 diff --git a/assets/mspec_logo.svg b/assets/mspec_logo.svg new file mode 100644 index 000000000..993a93814 --- /dev/null +++ b/assets/mspec_logo.svg @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> + +<svg + width="512" + height="512" + viewBox="0 0 512 512" + version="1.1" + xml:space="preserve" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg"> + <defs /> + <g> + <circle + style="fill:#9a9ea2;fill-opacity:1;stroke-width:0;stroke:none;stroke-dasharray:none" + cx="256" + cy="256" + r="247.52571" /> + <path + style="fill:#4f5153;fill-opacity:1;stroke-width:0;stroke-dasharray:none;stroke:none" + d="m 227.27462,67.69677 -8.80308,46.52843 a 149.39075,149.39075 0 0 0 -36.44584,14.81046 l -38.86429,-26.49812 -0.67335,0.67386 -39.27666,39.27666 -0.67386,0.67335 25.87594,37.95169 a 149.39075,149.39075 0 0 0 -16.36541,37.7703 l -44.351301,8.39122 v 0.95291 55.54545 0.95291 l 42.834081,8.1039 a 149.39075,149.39075 0 0 0 16.08997,40.68589 l -24.08328,35.32291 0.67386,0.67386 39.27666,39.27667 0.67335,0.67386 34.432,-23.47608 a 149.39075,149.39075 0 0 0 42.00157,17.72553 l 7.67964,40.5908 h 0.95291 55.54545 0.95291 l 7.67964,-40.5908 a 149.39075,149.39075 0 0 0 42.00105,-17.72553 l 34.43201,23.47608 0.67386,-0.67386 39.27667,-39.27667 0.67386,-0.67386 -24.0838,-35.32291 a 149.39075,149.39075 0 0 0 16.08997,-40.68589 l 42.83408,-8.1039 v -0.95291 -55.54545 -0.95291 l -44.35078,-8.3907 v -5.2e-4 a 149.39075,149.39075 0 0 0 -16.36541,-37.7703 l 25.87594,-37.95169 -0.67386,-0.67335 -39.27667,-39.27666 -0.67386,-0.67386 -38.8643,26.49812 A 149.39075,149.39075 0 0 0 293.52897,114.2252 l -8.80308,-46.52843 h -0.95291 -55.54545 z" /><circle + style="fill:#d7d9da;fill-opacity:1;stroke-width:0;stroke:none;stroke-dasharray:none" + id="path3" + cx="256" + cy="256" + r="84.321671" /> + </g> +</svg> diff --git a/build/build.cs b/build/build.cs index 2c6b19f34..fd024ea56 100644 --- a/build/build.cs +++ b/build/build.cs @@ -1,5 +1,5 @@ -#:package Bullseye@6.1.0 -#:package SimpleExec@13.0.0 +#:package Bullseye@6.2.0 +#:package SimpleExec@13.1.0 using static Bullseye.Targets; using static SimpleExec.Command; diff --git a/docs/.gitkeep b/docs/.gitkeep new file mode 100644 index 000000000..e69de29bb From b01f10ca9289f743270f489068184874dcce6410 Mon Sep 17 00:00:00 2001 From: Robert Coltheart <robert.coltheart@gmail.com> Date: Wed, 23 Sep 2026 20:56:26 +1000 Subject: [PATCH 04/10] jobs --- .github/workflows/build.yml | 7 ++----- .github/workflows/publish.yml | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5996f658a..5dd5f3212 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,12 +9,9 @@ on: permissions: contents: read -env: - DOTNET_NOLOGO: true - jobs: build: - name: Build + name: Build, test and package runs-on: ubuntu-latest steps: @@ -26,7 +23,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v5 with: - dotnet-version: 3.1.x + dotnet-version: 10.x - name: Install GitVersion uses: gittools/actions/gitversion/setup@v4 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c6412fb7d..7a56176ec 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,12 +9,9 @@ permissions: contents: read id-token: write -env: - DOTNET_NOLOGO: true - jobs: build: - name: Publish + name: Build and publish runs-on: ubuntu-latest steps: @@ -32,7 +29,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v5 with: - dotnet-version: 3.1.x + dotnet-version: 10.x - name: Install GitVersion uses: gittools/actions/gitversion/setup@v4 From 069f9dc6dc4ae1a171bad7458d356c0a6a796a19 Mon Sep 17 00:00:00 2001 From: Robert Coltheart <robert.coltheart@gmail.com> Date: Thu, 24 Sep 2026 06:40:45 +1000 Subject: [PATCH 05/10] fixes --- build/build.cs | 5 +++-- global.json | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 global.json diff --git a/build/build.cs b/build/build.cs index fd024ea56..b4adb474e 100644 --- a/build/build.cs +++ b/build/build.cs @@ -1,5 +1,6 @@ -#:package Bullseye@6.2.0 -#:package SimpleExec@13.1.0 +#:property TargetFramework=net10.0 +#:package Bullseye@6.1.0 +#:package SimpleExec@13.0.0 using static Bullseye.Targets; using static SimpleExec.Command; diff --git a/global.json b/global.json new file mode 100644 index 000000000..3140116df --- /dev/null +++ b/global.json @@ -0,0 +1,5 @@ +{ + "test": { + "runner": "Microsoft.Testing.Platform" + } +} From cf55763824467d45d8cc98a3c9bf2dc2ee85d318 Mon Sep 17 00:00:00 2001 From: Robert Coltheart <robert.coltheart@gmail.com> Date: Sun, 4 Oct 2026 21:48:38 +1100 Subject: [PATCH 06/10] update projects --- .github/workflows/build.yml | 2 +- Directory.Build.props | 1 - build/build.cs | 39 ++++------- src/Directory.Build.props | 9 +++ .../Machine.Specifications.Analyzers.csproj | 9 +-- .../MachineSpecStubs.cs | 2 +- .../install.ps1 | 58 ----------------- .../uninstall.ps1 | 65 ------------------- ...Specifications.Core.SourceGenerator.csproj | 4 +- .../Machine.Specifications.Core.csproj | 8 +++ ...hine.Specifications.Fakes.Analyzers.csproj | 5 -- ...pecifications.Fakes.SourceGenerator.csproj | 5 -- .../Machine.Specifications.Fakes.csproj | 4 -- .../Machine.Specifications.Should.csproj | 4 ++ .../Machine.Specifications.Templates.csproj | 5 -- tests/Directory.Build.props | 10 +++ ...hine.Specifications.Analyzers.Specs.csproj | 6 -- ...ications.Core.SourceGenerator.Specs.csproj | 7 -- .../Machine.Specifications.Core.Specs.csproj | 5 -- ...pecifications.Fakes.Analzyers.Specs.csproj | 7 -- ...cations.Fakes.SourceGenerator.Specs.csproj | 7 -- .../Machine.Specifications.Fakes.Specs.csproj | 7 +- .../Machine.Specifications.Fixtures.csproj | 4 -- ...Specifications.Runner.Utility.Specs.csproj | 5 -- ...ations.Runner.VisualStudio.Fixtures.csproj | 5 -- ...fications.Runner.VisualStudio.Specs.csproj | 5 -- ...Machine.Specifications.Should.Specs.csproj | 5 -- 27 files changed, 52 insertions(+), 241 deletions(-) create mode 100644 src/Directory.Build.props delete mode 100644 src/Machine.Specifications.Analyzers/install.ps1 delete mode 100644 src/Machine.Specifications.Analyzers/uninstall.ps1 create mode 100644 tests/Directory.Build.props diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5dd5f3212..624f08833 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,4 +34,4 @@ jobs: uses: gittools/actions/gitversion/execute@v4 - name: Build - run: ./build.sh + run: ./build.sh build diff --git a/Directory.Build.props b/Directory.Build.props index 1ebe88e62..6cba54252 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,6 @@ <Project> <PropertyGroup> - <TargetFramework>netstandard2.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> <LangVersion>latest</LangVersion> diff --git a/build/build.cs b/build/build.cs index b4adb474e..fe949a34e 100644 --- a/build/build.cs +++ b/build/build.cs @@ -1,11 +1,10 @@ -#:property TargetFramework=net10.0 -#:package Bullseye@6.1.0 +#:package Bullseye@6.1.0 #:package SimpleExec@13.0.0 using static Bullseye.Targets; using static SimpleExec.Command; -var version = new GitVersion(); +var version = default(string); Target("clean", () => { @@ -17,20 +16,21 @@ } }); +Target("version", () => +{ + version = Environment.GetEnvironmentVariable("GITHUB_REF_TYPE") is "tag" + ? Environment.GetEnvironmentVariable("GITHUB_REF_NAME")?.TrimStart('v') + : $"0.0.${Environment.GetEnvironmentVariable("GITHUB_RUN_NUMBER")}"; +}); + Target("restore", dependsOn: ["clean"], () => { Run("dotnet", "restore"); }); -Target("build", dependsOn: ["restore"], () => +Target("build", dependsOn: ["restore", "version"], () => { - Run("dotnet", "build " + - "--no-restore " + - "--configuration Release " + - $"--property Version={version.SemVer} " + - $"--property AssemblyVersion={version.AssemblySemVer} " + - $"--property FileVersion={version.AssemblySemFileVer} " + - $"--property InformationalVersion={version.InformationalVersion}"); + Run("dotnet", $"build --configuration Release --no-restore --property Version={version}"); }); Target("test", dependsOn: ["build"], () => @@ -38,29 +38,18 @@ Run("dotnet", "test --configuration Release --no-restore --no-build"); }); -Target("package", dependsOn: ["build", "test"], () => +Target("package", dependsOn: ["build", "test", "version"], () => { - Run("dotnet", $"pack --configuration Release --no-restore --no-build --output artifacts --property Version={version.SemVer}"); + Run("dotnet", $"pack --configuration Release --no-restore --no-build --output artifacts --property Version={version}"); }); Target("publish", dependsOn: ["package"], () => { var apiKey = Environment.GetEnvironmentVariable("NUGET_API_KEY"); - Run("dotnet", $"nuget push {Path.Combine("artifacts", "*.nupkg")} --api-key {apiKey} --source https://api.nuget.org/v3/index.json"); + Run("dotnet", $"nuget push artifacts/*.nupkg --api-key {apiKey} --source https://api.nuget.org/v3/index.json"); }); Target("default", dependsOn: ["package"]); await RunTargetsAndExitAsync(args); - -public class GitVersion -{ - public string SemVer { get; } = Environment.GetEnvironmentVariable("GitVersion_SemVer") ?? "0.1.0"; - - public string AssemblySemVer { get; } = Environment.GetEnvironmentVariable("GitVersion_AssemblySemVer") ?? "0.1.0"; - - public string AssemblySemFileVer { get; } = Environment.GetEnvironmentVariable("GitVersion_AssemblySemFileVer") ?? "0.1.0"; - - public string InformationalVersion { get; } = Environment.GetEnvironmentVariable("GitVersion_InformationalVersion") ?? "0.1.0"; -} diff --git a/src/Directory.Build.props b/src/Directory.Build.props new file mode 100644 index 000000000..c6ef25973 --- /dev/null +++ b/src/Directory.Build.props @@ -0,0 +1,9 @@ +<Project> + + <Import Project="../Directory.Build.props" /> + + <PropertyGroup> + <TargetFramework>netstandard2.0</TargetFramework> + </PropertyGroup> + +</Project> diff --git a/src/Machine.Specifications.Analyzers/Machine.Specifications.Analyzers.csproj b/src/Machine.Specifications.Analyzers/Machine.Specifications.Analyzers.csproj index 74d8d02b4..9a511ee01 100644 --- a/src/Machine.Specifications.Analyzers/Machine.Specifications.Analyzers.csproj +++ b/src/Machine.Specifications.Analyzers/Machine.Specifications.Analyzers.csproj @@ -4,7 +4,6 @@ <IncludeBuildOutput>false</IncludeBuildOutput> <DevelopmentDependency>true</DevelopmentDependency> <EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules> - <TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackageItems</TargetsForTfmSpecificContentInPackage> </PropertyGroup> <PropertyGroup> @@ -16,13 +15,7 @@ </ItemGroup> <ItemGroup> - <None Update="*.ps1" CopyToOutputDirectory="Always" Pack="true" PackagePath="tools" Visible="false" /> + <TfmSpecificPackageFile Include="$(TargetPath)" Pack="true" PackagePath="analyzers/dotnet/cs" /> </ItemGroup> - <Target Name="PackageItems"> - <ItemGroup> - <TfmSpecificPackageFile Include="$(OutputPath)\$(AssemblyName).dll" PackagePath="analyzers/dotnet/cs" /> - </ItemGroup> - </Target> - </Project> diff --git a/src/Machine.Specifications.Analyzers/MachineSpecStubs.cs b/src/Machine.Specifications.Analyzers/MachineSpecStubs.cs index 1affc07dc..8b7093163 100644 --- a/src/Machine.Specifications.Analyzers/MachineSpecStubs.cs +++ b/src/Machine.Specifications.Analyzers/MachineSpecStubs.cs @@ -1,4 +1,4 @@ -namespace Machine.Specifications; +namespace Machine.Specifications; public class SetupDelegateAttribute : Attribute { diff --git a/src/Machine.Specifications.Analyzers/install.ps1 b/src/Machine.Specifications.Analyzers/install.ps1 deleted file mode 100644 index ff051759d..000000000 --- a/src/Machine.Specifications.Analyzers/install.ps1 +++ /dev/null @@ -1,58 +0,0 @@ -param($installPath, $toolsPath, $package, $project) - -if($project.Object.SupportsPackageDependencyResolution) -{ - if($project.Object.SupportsPackageDependencyResolution()) - { - # Do not install analyzers via install.ps1, instead let the project system handle it. - return - } -} - -$analyzersPaths = Join-Path (Join-Path (Split-Path -Path $toolsPath -Parent) "analyzers") * -Resolve - -foreach($analyzersPath in $analyzersPaths) -{ - if (Test-Path $analyzersPath) - { - # Install the language agnostic analyzers. - foreach ($analyzerFilePath in Get-ChildItem -Path "$analyzersPath\*.dll" -Exclude *.resources.dll) - { - if($project.Object.AnalyzerReferences) - { - $project.Object.AnalyzerReferences.Add($analyzerFilePath.FullName) - } - } - } -} - -# $project.Type gives the language name like (C# or VB.NET) -$languageFolder = "" -if($project.Type -eq "C#") -{ - $languageFolder = "cs" -} -if($project.Type -eq "VB.NET") -{ - $languageFolder = "vb" -} -if($languageFolder -eq "") -{ - return -} - -foreach($analyzersPath in $analyzersPaths) -{ - # Install language specific analyzers. - $languageAnalyzersPath = join-path $analyzersPath $languageFolder - if (Test-Path $languageAnalyzersPath) - { - foreach ($analyzerFilePath in Get-ChildItem -Path "$languageAnalyzersPath\*.dll" -Exclude *.resources.dll) - { - if($project.Object.AnalyzerReferences) - { - $project.Object.AnalyzerReferences.Add($analyzerFilePath.FullName) - } - } - } -} diff --git a/src/Machine.Specifications.Analyzers/uninstall.ps1 b/src/Machine.Specifications.Analyzers/uninstall.ps1 deleted file mode 100644 index 4bed33374..000000000 --- a/src/Machine.Specifications.Analyzers/uninstall.ps1 +++ /dev/null @@ -1,65 +0,0 @@ -param($installPath, $toolsPath, $package, $project) - -if($project.Object.SupportsPackageDependencyResolution) -{ - if($project.Object.SupportsPackageDependencyResolution()) - { - # Do not uninstall analyzers via uninstall.ps1, instead let the project system handle it. - return - } -} - -$analyzersPaths = Join-Path (Join-Path (Split-Path -Path $toolsPath -Parent) "analyzers") * -Resolve - -foreach($analyzersPath in $analyzersPaths) -{ - # Uninstall the language agnostic analyzers. - if (Test-Path $analyzersPath) - { - foreach ($analyzerFilePath in Get-ChildItem -Path "$analyzersPath\*.dll" -Exclude *.resources.dll) - { - if($project.Object.AnalyzerReferences) - { - $project.Object.AnalyzerReferences.Remove($analyzerFilePath.FullName) - } - } - } -} - -# $project.Type gives the language name like (C# or VB.NET) -$languageFolder = "" -if($project.Type -eq "C#") -{ - $languageFolder = "cs" -} -if($project.Type -eq "VB.NET") -{ - $languageFolder = "vb" -} -if($languageFolder -eq "") -{ - return -} - -foreach($analyzersPath in $analyzersPaths) -{ - # Uninstall language specific analyzers. - $languageAnalyzersPath = join-path $analyzersPath $languageFolder - if (Test-Path $languageAnalyzersPath) - { - foreach ($analyzerFilePath in Get-ChildItem -Path "$languageAnalyzersPath\*.dll" -Exclude *.resources.dll) - { - if($project.Object.AnalyzerReferences) - { - try - { - $project.Object.AnalyzerReferences.Remove($analyzerFilePath.FullName) - } - catch - { - - } - } - } - } -} diff --git a/src/Machine.Specifications.Core.SourceGenerator/Machine.Specifications.Core.SourceGenerator.csproj b/src/Machine.Specifications.Core.SourceGenerator/Machine.Specifications.Core.SourceGenerator.csproj index dbdcea46b..3a421494b 100644 --- a/src/Machine.Specifications.Core.SourceGenerator/Machine.Specifications.Core.SourceGenerator.csproj +++ b/src/Machine.Specifications.Core.SourceGenerator/Machine.Specifications.Core.SourceGenerator.csproj @@ -1,7 +1,9 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>netstandard2.0</TargetFramework> + <EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules> + <IsPackable>false</IsPackable> + <IsRoslynComponent>true</IsRoslynComponent> </PropertyGroup> </Project> diff --git a/src/Machine.Specifications.Core/Machine.Specifications.Core.csproj b/src/Machine.Specifications.Core/Machine.Specifications.Core.csproj index eebcd5820..483bc167c 100644 --- a/src/Machine.Specifications.Core/Machine.Specifications.Core.csproj +++ b/src/Machine.Specifications.Core/Machine.Specifications.Core.csproj @@ -12,4 +12,12 @@ <PackageReference Include="System.Threading.Tasks.Extensions" Version="4.6.3" /> </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\Machine.Specifications.Core.SourceGenerator\Machine.Specifications.Core.SourceGenerator.csproj" /> + </ItemGroup> + + <ItemGroup> + <TfmSpecificPackageFile Include="$(TargetDir)$(AssemblyName).SourceGenerator.dll" Pack="true" PackagePath="analyzers/dotnet/cs" /> + </ItemGroup> + </Project> diff --git a/src/Machine.Specifications.Fakes.Analyzers/Machine.Specifications.Fakes.Analyzers.csproj b/src/Machine.Specifications.Fakes.Analyzers/Machine.Specifications.Fakes.Analyzers.csproj index dbdcea46b..bef03830d 100644 --- a/src/Machine.Specifications.Fakes.Analyzers/Machine.Specifications.Fakes.Analyzers.csproj +++ b/src/Machine.Specifications.Fakes.Analyzers/Machine.Specifications.Fakes.Analyzers.csproj @@ -1,7 +1,2 @@ <Project Sdk="Microsoft.NET.Sdk"> - - <PropertyGroup> - <TargetFramework>netstandard2.0</TargetFramework> - </PropertyGroup> - </Project> diff --git a/src/Machine.Specifications.Fakes.SourceGenerator/Machine.Specifications.Fakes.SourceGenerator.csproj b/src/Machine.Specifications.Fakes.SourceGenerator/Machine.Specifications.Fakes.SourceGenerator.csproj index dbdcea46b..bef03830d 100644 --- a/src/Machine.Specifications.Fakes.SourceGenerator/Machine.Specifications.Fakes.SourceGenerator.csproj +++ b/src/Machine.Specifications.Fakes.SourceGenerator/Machine.Specifications.Fakes.SourceGenerator.csproj @@ -1,7 +1,2 @@ <Project Sdk="Microsoft.NET.Sdk"> - - <PropertyGroup> - <TargetFramework>netstandard2.0</TargetFramework> - </PropertyGroup> - </Project> diff --git a/src/Machine.Specifications.Fakes/Machine.Specifications.Fakes.csproj b/src/Machine.Specifications.Fakes/Machine.Specifications.Fakes.csproj index cc67fc1c0..b33e0d1b2 100644 --- a/src/Machine.Specifications.Fakes/Machine.Specifications.Fakes.csproj +++ b/src/Machine.Specifications.Fakes/Machine.Specifications.Fakes.csproj @@ -1,9 +1,5 @@ <Project Sdk="Microsoft.NET.Sdk"> - <PropertyGroup> - <IsPackable>false</IsPackable> - </PropertyGroup> - <ItemGroup> <PackageReference Include="System.Reflection.Emit" Version="4.7.0" /> </ItemGroup> diff --git a/src/Machine.Specifications.Should/Machine.Specifications.Should.csproj b/src/Machine.Specifications.Should/Machine.Specifications.Should.csproj index 9b9b8ea5e..5e7f57426 100644 --- a/src/Machine.Specifications.Should/Machine.Specifications.Should.csproj +++ b/src/Machine.Specifications.Should/Machine.Specifications.Should.csproj @@ -1,5 +1,9 @@ <Project Sdk="Microsoft.NET.Sdk"> + <PropertyGroup> + <RootNamespace>Machine.Specifications</RootNamespace> + </PropertyGroup> + <PropertyGroup> <Description>Assertion library for Machine.Specifications</Description> </PropertyGroup> diff --git a/src/Machine.Specifications.Templates/Machine.Specifications.Templates.csproj b/src/Machine.Specifications.Templates/Machine.Specifications.Templates.csproj index dbdcea46b..bef03830d 100644 --- a/src/Machine.Specifications.Templates/Machine.Specifications.Templates.csproj +++ b/src/Machine.Specifications.Templates/Machine.Specifications.Templates.csproj @@ -1,7 +1,2 @@ <Project Sdk="Microsoft.NET.Sdk"> - - <PropertyGroup> - <TargetFramework>netstandard2.0</TargetFramework> - </PropertyGroup> - </Project> diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props new file mode 100644 index 000000000..839a65f1b --- /dev/null +++ b/tests/Directory.Build.props @@ -0,0 +1,10 @@ +<Project> + + <Import Project="../Directory.Build.props" /> + + <PropertyGroup> + <TargetFramework>net10.0</TargetFramework> + <IsPackable>false</IsPackable> + </PropertyGroup> + +</Project> diff --git a/tests/Machine.Specifications.Analyzers.Specs/Machine.Specifications.Analyzers.Specs.csproj b/tests/Machine.Specifications.Analyzers.Specs/Machine.Specifications.Analyzers.Specs.csproj index 73f2811d8..b43d47fba 100644 --- a/tests/Machine.Specifications.Analyzers.Specs/Machine.Specifications.Analyzers.Specs.csproj +++ b/tests/Machine.Specifications.Analyzers.Specs/Machine.Specifications.Analyzers.Specs.csproj @@ -1,11 +1,5 @@ <Project Sdk="Microsoft.NET.Sdk"> - <PropertyGroup> - <TargetFramework>net10.0</TargetFramework> - <ImplicitUsings>enable</ImplicitUsings> - <Nullable>enable</Nullable> - </PropertyGroup> - <ItemGroup> <PackageReference Include="Microsoft.CodeAnalysis" Version="5.0.0" /> <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing" Version="1.1.4" /> diff --git a/tests/Machine.Specifications.Core.SourceGenerator.Specs/Machine.Specifications.Core.SourceGenerator.Specs.csproj b/tests/Machine.Specifications.Core.SourceGenerator.Specs/Machine.Specifications.Core.SourceGenerator.Specs.csproj index b76014470..bef03830d 100644 --- a/tests/Machine.Specifications.Core.SourceGenerator.Specs/Machine.Specifications.Core.SourceGenerator.Specs.csproj +++ b/tests/Machine.Specifications.Core.SourceGenerator.Specs/Machine.Specifications.Core.SourceGenerator.Specs.csproj @@ -1,9 +1,2 @@ <Project Sdk="Microsoft.NET.Sdk"> - - <PropertyGroup> - <TargetFramework>net10.0</TargetFramework> - <ImplicitUsings>enable</ImplicitUsings> - <Nullable>enable</Nullable> - </PropertyGroup> - </Project> diff --git a/tests/Machine.Specifications.Core.Specs/Machine.Specifications.Core.Specs.csproj b/tests/Machine.Specifications.Core.Specs/Machine.Specifications.Core.Specs.csproj index 6e8313733..da11eb34c 100644 --- a/tests/Machine.Specifications.Core.Specs/Machine.Specifications.Core.Specs.csproj +++ b/tests/Machine.Specifications.Core.Specs/Machine.Specifications.Core.Specs.csproj @@ -1,10 +1,5 @@ <Project Sdk="Microsoft.NET.Sdk"> - <PropertyGroup> - <TargetFramework>net10.0</TargetFramework> - <IsPackable>false</IsPackable> - </PropertyGroup> - <ItemGroup> <ProjectReference Include="..\..\src\Machine.Specifications.Core\Machine.Specifications.Core.csproj" /> <ProjectReference Include="..\..\src\Machine.Specifications.Should\Machine.Specifications.Should.csproj" /> diff --git a/tests/Machine.Specifications.Fakes.Analzyers.Specs/Machine.Specifications.Fakes.Analzyers.Specs.csproj b/tests/Machine.Specifications.Fakes.Analzyers.Specs/Machine.Specifications.Fakes.Analzyers.Specs.csproj index b76014470..bef03830d 100644 --- a/tests/Machine.Specifications.Fakes.Analzyers.Specs/Machine.Specifications.Fakes.Analzyers.Specs.csproj +++ b/tests/Machine.Specifications.Fakes.Analzyers.Specs/Machine.Specifications.Fakes.Analzyers.Specs.csproj @@ -1,9 +1,2 @@ <Project Sdk="Microsoft.NET.Sdk"> - - <PropertyGroup> - <TargetFramework>net10.0</TargetFramework> - <ImplicitUsings>enable</ImplicitUsings> - <Nullable>enable</Nullable> - </PropertyGroup> - </Project> diff --git a/tests/Machine.Specifications.Fakes.SourceGenerator.Specs/Machine.Specifications.Fakes.SourceGenerator.Specs.csproj b/tests/Machine.Specifications.Fakes.SourceGenerator.Specs/Machine.Specifications.Fakes.SourceGenerator.Specs.csproj index b76014470..bef03830d 100644 --- a/tests/Machine.Specifications.Fakes.SourceGenerator.Specs/Machine.Specifications.Fakes.SourceGenerator.Specs.csproj +++ b/tests/Machine.Specifications.Fakes.SourceGenerator.Specs/Machine.Specifications.Fakes.SourceGenerator.Specs.csproj @@ -1,9 +1,2 @@ <Project Sdk="Microsoft.NET.Sdk"> - - <PropertyGroup> - <TargetFramework>net10.0</TargetFramework> - <ImplicitUsings>enable</ImplicitUsings> - <Nullable>enable</Nullable> - </PropertyGroup> - </Project> diff --git a/tests/Machine.Specifications.Fakes.Specs/Machine.Specifications.Fakes.Specs.csproj b/tests/Machine.Specifications.Fakes.Specs/Machine.Specifications.Fakes.Specs.csproj index 96931d882..f25d703ea 100644 --- a/tests/Machine.Specifications.Fakes.Specs/Machine.Specifications.Fakes.Specs.csproj +++ b/tests/Machine.Specifications.Fakes.Specs/Machine.Specifications.Fakes.Specs.csproj @@ -1,11 +1,6 @@ <Project Sdk="Microsoft.NET.Sdk"> - <PropertyGroup> - <TargetFramework>net10.0</TargetFramework> - <IsPackable>false</IsPackable> - </PropertyGroup> - - <ItemGroup> +<ItemGroup> <ProjectReference Include="..\..\src\Machine.Specifications.Core\Machine.Specifications.Core.csproj" /> <ProjectReference Include="..\..\src\Machine.Specifications.Fakes\Machine.Specifications.Fakes.csproj" /> <ProjectReference Include="..\..\src\Machine.Specifications.Should\Machine.Specifications.Should.csproj" /> diff --git a/tests/Machine.Specifications.Fixtures/Machine.Specifications.Fixtures.csproj b/tests/Machine.Specifications.Fixtures/Machine.Specifications.Fixtures.csproj index a2e918693..42475085b 100644 --- a/tests/Machine.Specifications.Fixtures/Machine.Specifications.Fixtures.csproj +++ b/tests/Machine.Specifications.Fixtures/Machine.Specifications.Fixtures.csproj @@ -1,9 +1,5 @@ <Project Sdk="Microsoft.NET.Sdk"> - <PropertyGroup> - <IsPackable>false</IsPackable> - </PropertyGroup> - <ItemGroup> <ProjectReference Include="..\Machine.Specifications.Core\Machine.Specifications.Core.csproj" /> <ProjectReference Include="..\Machine.Specifications.Should\Machine.Specifications.Should.csproj" /> diff --git a/tests/Machine.Specifications.Runner.Utility.Specs/Machine.Specifications.Runner.Utility.Specs.csproj b/tests/Machine.Specifications.Runner.Utility.Specs/Machine.Specifications.Runner.Utility.Specs.csproj index 662ef0631..025df8c9f 100644 --- a/tests/Machine.Specifications.Runner.Utility.Specs/Machine.Specifications.Runner.Utility.Specs.csproj +++ b/tests/Machine.Specifications.Runner.Utility.Specs/Machine.Specifications.Runner.Utility.Specs.csproj @@ -1,10 +1,5 @@ <Project Sdk="Microsoft.NET.Sdk"> - <PropertyGroup> - <TargetFrameworks>net10.0</TargetFrameworks> - <IsPackable>false</IsPackable> - </PropertyGroup> - <ItemGroup> <PackageReference Include="Microsoft.CodeAnalysis.Compilers" Version="4.12.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" /> diff --git a/tests/Machine.Specifications.Runner.VisualStudio.Fixtures/Machine.Specifications.Runner.VisualStudio.Fixtures.csproj b/tests/Machine.Specifications.Runner.VisualStudio.Fixtures/Machine.Specifications.Runner.VisualStudio.Fixtures.csproj index 98b564ca3..1079634a8 100644 --- a/tests/Machine.Specifications.Runner.VisualStudio.Fixtures/Machine.Specifications.Runner.VisualStudio.Fixtures.csproj +++ b/tests/Machine.Specifications.Runner.VisualStudio.Fixtures/Machine.Specifications.Runner.VisualStudio.Fixtures.csproj @@ -1,10 +1,5 @@ <Project Sdk="Microsoft.NET.Sdk"> - <PropertyGroup> - <TargetFramework>netstandard2.0</TargetFramework> - <IsPackable>false</IsPackable> - </PropertyGroup> - <ItemGroup> <PackageReference Include="InternalsVisibleTo.MSBuild" Version="1.1.0"> <PrivateAssets>all</PrivateAssets> diff --git a/tests/Machine.Specifications.Runner.VisualStudio.Specs/Machine.Specifications.Runner.VisualStudio.Specs.csproj b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Machine.Specifications.Runner.VisualStudio.Specs.csproj index 1e1cda414..8f839e8bf 100644 --- a/tests/Machine.Specifications.Runner.VisualStudio.Specs/Machine.Specifications.Runner.VisualStudio.Specs.csproj +++ b/tests/Machine.Specifications.Runner.VisualStudio.Specs/Machine.Specifications.Runner.VisualStudio.Specs.csproj @@ -1,10 +1,5 @@ <Project Sdk="Microsoft.NET.Sdk"> - <PropertyGroup> - <TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks> - <IsPackable>false</IsPackable> - </PropertyGroup> - <ItemGroup> <PackageReference Include="Machine.Fakes.Moq" Version="2.11.0" /> <PackageReference Include="Machine.Specifications.Should" Version="1.0.0" /> diff --git a/tests/Machine.Specifications.Should.Specs/Machine.Specifications.Should.Specs.csproj b/tests/Machine.Specifications.Should.Specs/Machine.Specifications.Should.Specs.csproj index 6e8313733..da11eb34c 100644 --- a/tests/Machine.Specifications.Should.Specs/Machine.Specifications.Should.Specs.csproj +++ b/tests/Machine.Specifications.Should.Specs/Machine.Specifications.Should.Specs.csproj @@ -1,10 +1,5 @@ <Project Sdk="Microsoft.NET.Sdk"> - <PropertyGroup> - <TargetFramework>net10.0</TargetFramework> - <IsPackable>false</IsPackable> - </PropertyGroup> - <ItemGroup> <ProjectReference Include="..\..\src\Machine.Specifications.Core\Machine.Specifications.Core.csproj" /> <ProjectReference Include="..\..\src\Machine.Specifications.Should\Machine.Specifications.Should.csproj" /> From ccfd325196990a0c693b3137bdb324e515caa178 Mon Sep 17 00:00:00 2001 From: Robert Coltheart <robert.coltheart@gmail.com> Date: Sun, 4 Oct 2026 21:50:03 +1100 Subject: [PATCH 07/10] fix version --- build/build.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build.cs b/build/build.cs index fe949a34e..329c46853 100644 --- a/build/build.cs +++ b/build/build.cs @@ -20,7 +20,7 @@ { version = Environment.GetEnvironmentVariable("GITHUB_REF_TYPE") is "tag" ? Environment.GetEnvironmentVariable("GITHUB_REF_NAME")?.TrimStart('v') - : $"0.0.${Environment.GetEnvironmentVariable("GITHUB_RUN_NUMBER")}"; + : $"0.0.{Environment.GetEnvironmentVariable("GITHUB_RUN_NUMBER")}"; }); Target("restore", dependsOn: ["clean"], () => From 43c178b3b61447f77c5033668212894fc2f352cc Mon Sep 17 00:00:00 2001 From: Robert Coltheart <robert.coltheart@gmail.com> Date: Sun, 4 Oct 2026 21:56:12 +1100 Subject: [PATCH 08/10] test versioning --- .github/workflows/build.yml | 4 ++-- .github/workflows/publish.yml | 1 + build/build.cs | 4 +--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 624f08833..12963ef30 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,11 +27,11 @@ jobs: - name: Install GitVersion uses: gittools/actions/gitversion/setup@v4 - with: - versionSpec: 6.x - name: Calculate version uses: gittools/actions/gitversion/execute@v4 - name: Build + env: + VERSION: ${{ env.GitVersion_SemVer }} run: ./build.sh build diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7a56176ec..622a1f5dd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -41,5 +41,6 @@ jobs: - name: Deploy env: + VERSION: ${{ env.GitVersion_SemVer }} NUGET_API_KEY: ${{ steps.login.outputs.NUGET_API_KEY }} run: ./build.sh publish diff --git a/build/build.cs b/build/build.cs index 329c46853..6e0d29a82 100644 --- a/build/build.cs +++ b/build/build.cs @@ -18,9 +18,7 @@ Target("version", () => { - version = Environment.GetEnvironmentVariable("GITHUB_REF_TYPE") is "tag" - ? Environment.GetEnvironmentVariable("GITHUB_REF_NAME")?.TrimStart('v') - : $"0.0.{Environment.GetEnvironmentVariable("GITHUB_RUN_NUMBER")}"; + version = Environment.GetEnvironmentVariable("VERSION"); }); Target("restore", dependsOn: ["clean"], () => From 71b8d6e6378af90899f44b66a9b9f4f8c33b860b Mon Sep 17 00:00:00 2001 From: Robert Coltheart <robert.coltheart@gmail.com> Date: Mon, 5 Oct 2026 21:17:01 +1100 Subject: [PATCH 09/10] update agents --- AGENTS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 83f7d3bcc..d74a4b724 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,10 +1,10 @@ # Machine.Specificaitons Agent Guide -**Machine.Specifications** is also known colloquially as **MSpec**. +**Machine.Specifications** is also known as **MSpec**. ## Project architecture All code for MSpec lives in `src` or `tests`. Documentation is in `docs`, and logos for NuGet are in `assets`. -The below projects are in use by this project. You should **ignore** any other project that is not in this list. +The below source projects are in use by this project, along with test projects. You should **ignore** any other project that is not referenced in the `.slnx` file in the repo root. - `Machine.Specifications` - Meta NuGet package that references the default set of dependencies - `Machine.Specifications.Analyzers` - Code hints and fixes for writing tests "the MSpec way" From 258d4cb3c750d1747e52bfd3e2d94530e56cf119 Mon Sep 17 00:00:00 2001 From: Robert Coltheart <robert.coltheart@gmail.com> Date: Mon, 5 Oct 2026 21:18:38 +1100 Subject: [PATCH 10/10] build --- build.ps1 | 2 +- build.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.ps1 b/build.ps1 index 603c8f435..53e55af94 100644 --- a/build.ps1 +++ b/build.ps1 @@ -10,7 +10,7 @@ if ($null -eq (Get-Command "dotnet" -ErrorAction Ignore)) { Push-Location (Split-Path $MyInvocation.MyCommand.Definition) try { - & dotnet run ./build/build.cs -- $args + & dotnet ./build/build.cs -- $args } finally { Pop-Location diff --git a/build.sh b/build.sh index 7e6904a8d..e1e918593 100755 --- a/build.sh +++ b/build.sh @@ -3,7 +3,7 @@ set -euo pipefail if which dotnet > /dev/null; then - dotnet run ./build/build.cs -- "$@" + dotnet ./build/build.cs -- "$@" else echo "error(1): Could not find 'dotnet', please install .NET SDK" exit 1