Skip to content

Commit

Permalink
Consolidate VS runner into mspec repo (#539)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertcoltheart authored Dec 20, 2024
1 parent 1e575ba commit b8b67d1
Show file tree
Hide file tree
Showing 82 changed files with 2,992 additions and 54 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ env:
jobs:
build:
name: build
runs-on: windows-latest
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Fetch all tags and branches
run: git fetch --prune --unshallow
- name: Build
run: ./build.ps1
run: ./build.sh
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
path: artifacts/*.nupkg
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ env:
jobs:
publish:
name: publish
runs-on: windows-latest
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Fetch all tags and branches
run: git fetch --prune --unshallow
- name: Deploy
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: ./build.ps1 publish
run: ./build.sh publish
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
path: artifacts/*.nupkg
4 changes: 1 addition & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project>
<PropertyGroup>
<RootNamespace>Machine.Specifications</RootNamespace>
</PropertyGroup>

<PropertyGroup>
<Authors>Machine Specifications</Authors>
Expand All @@ -17,4 +14,5 @@
<ItemGroup>
<None Include="../../images/icon.png" Pack="true" PackagePath="" Visible="false" />
</ItemGroup>

</Project>
8 changes: 7 additions & 1 deletion Machine.Specifications.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.12.35527.113 d17.12
VisualStudioVersion = 17.12.35527.113
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Machine.Specifications", "src\Machine.Specifications\Machine.Specifications.csproj", "{EC054D80-8858-4A61-9FD9-0185EA3F4643}"
EndProject
Expand All @@ -27,6 +27,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Machine.Specifications.Fake
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Machine.Specifications.Fakes.Specs", "src\Machine.Specifications.Fakes.Specs\Machine.Specifications.Fakes.Specs.csproj", "{B897126F-BF01-4A97-965D-C2DE1BC63460}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Machine.Specifications.Runner.VisualStudio", "src\Machine.Specifications.Runner.VisualStudio\Machine.Specifications.Runner.VisualStudio.csproj", "{D7689810-9604-4E3E-9821-28ABA130B28E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -81,6 +83,10 @@ Global
{B897126F-BF01-4A97-965D-C2DE1BC63460}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B897126F-BF01-4A97-965D-C2DE1BC63460}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B897126F-BF01-4A97-965D-C2DE1BC63460}.Release|Any CPU.Build.0 = Release|Any CPU
{D7689810-9604-4E3E-9821-28ABA130B28E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D7689810-9604-4E3E-9821-28ABA130B28E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D7689810-9604-4E3E-9821-28ABA130B28E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D7689810-9604-4E3E-9821-28ABA130B28E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand All @@ -13,15 +15,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.12.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing" Version="1.1.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing" Version="1.1.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="xunit.v3" Version="1.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<IncludeBuildOutput>false</IncludeBuildOutput>
<DevelopmentDependency>true</DevelopmentDependency>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackageItems</TargetsForTfmSpecificContentInPackage>
Expand All @@ -15,7 +16,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.11.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.12.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private SyntaxNode HandleDeclaration(MemberDeclarationSyntax declaration)
.WithLeadingTrivia(trivia);
}

private SyntaxNode GetParentDeclaration(SyntaxNode declaration)
private SyntaxNode? GetParentDeclaration(SyntaxNode? declaration)
{
while (declaration != null)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="Machine.Specifications.Runner.VisualStudio" Version="2.10.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Machine.Specifications.Core\Machine.Specifications.Core.csproj" />
<ProjectReference Include="..\Machine.Specifications.Fixtures\Machine.Specifications.Fixtures.csproj" />
<ProjectReference Include="..\Machine.Specifications.Runner.VisualStudio\Machine.Specifications.Runner.VisualStudio.csproj" />
<ProjectReference Include="..\Machine.Specifications.Should\Machine.Specifications.Should.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@

<PropertyGroup>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<RootNamespace>Machine.Specifications</RootNamespace>
<AssemblyName>Machine.Specifications</AssemblyName>
<PackageId>Machine.Specifications.Core</PackageId>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup>
<Description>Machine.Specifications is a Context/Specification framework geared towards removing language noise and simplifying tests</Description>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.6.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Machine.Specifications.Runner.VisualStudio" Version="2.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Machine.Specifications.Core\Machine.Specifications.Core.csproj" />
<ProjectReference Include="..\Machine.Specifications.Fakes\Machine.Specifications.Fakes.csproj" />
<ProjectReference Include="..\Machine.Specifications.Runner.VisualStudio\Machine.Specifications.Runner.VisualStudio.csproj" />
<ProjectReference Include="..\Machine.Specifications.Should\Machine.Specifications.Should.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

<PropertyGroup>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Reflection.Emit" Version="4.3.0" />
<PackageReference Include="System.Reflection.Emit" Version="4.7.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

<PropertyGroup>
<TargetFrameworks>net472;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Machine.Specifications.Core\Machine.Specifications.Core.csproj" />
<ProjectReference Include="..\Machine.Specifications.Should\Machine.Specifications.Should.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Compilers" Version="4.6.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="Machine.Specifications.Runner.VisualStudio" Version="2.10.2" />
<PackageReference Include="Microsoft.CodeAnalysis.Compilers" Version="4.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Machine.Specifications.Core\Machine.Specifications.Core.csproj" />
<ProjectReference Include="..\Machine.Specifications.Runner.Utility\Machine.Specifications.Runner.Utility.csproj" />
<ProjectReference Include="..\Machine.Specifications.Runner.VisualStudio\Machine.Specifications.Runner.VisualStudio.csproj" />
<ProjectReference Include="..\Machine.Specifications.Should\Machine.Specifications.Should.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

<PropertyGroup>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup>
Expand Down
103 changes: 103 additions & 0 deletions src/Machine.Specifications.Runner.VisualStudio.Fixtures/FixtureCode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
using System;
using System.Collections.Generic;
using Machine.Specifications;

namespace SampleSpecs
{
[Behaviors]
public class SampleBehavior
{
It sample_behavior_test = () =>
true.ShouldBeTrue();
}

class BehaviorSampleSpec
{
Because of = () => { };

Behaves_like<SampleBehavior> some_behavior;
}

class CleanupSpec
{
static int cleanup_count;

Because of = () => { };

Cleanup after = () =>
cleanup_count++;

It should_not_increment_cleanup = () =>
cleanup_count.ShouldEqual(0);

It should_have_no_cleanups = () =>
cleanup_count.ShouldEqual(0);
}

[AssertDelegate]
public delegate void They();

[ActDelegate]
public delegate void WhenDoing();

class CustomActAssertDelegateSpec
{
static string a;
static string b;

static int resultA;
static int resultB;

Establish context = () =>
{
a = "foo";
b = "foo";
};

WhenDoing of = () =>
{
resultA = a.GetHashCode();
resultB = b.GetHashCode();
};

They should_have_the_same_hash_code = () => resultA.ShouldEqual(resultB);
}

class Parent
{
class NestedSpec
{
It should_remember_that_true_is_true = () =>
true.ShouldBeTrue();
}
}

class StandardSpec
{
Because of = () => { };

It should_pass = () =>
1.ShouldEqual(1);

[Ignore("reason")]
It should_be_ignored = () => { };

It should_fail = () =>
1.ShouldEqual(2);

It unhandled_exception = () =>
{
throw new NotImplementedException();
};

It not_implemented;
}

class When_something
{
Because of = () => { };

It should_pass = () =>
1.ShouldEqual(1);
}
}
Loading

0 comments on commit b8b67d1

Please sign in to comment.