Skip to content

Commit 5a4d43e

Browse files
Changes to support 2024.3 (#342)
* Changes to support 2024.3 * strip tests out 😡 * gh workflow * artifacts * name * refs * tidy csproj
1 parent b02f91f commit 5a4d43e

119 files changed

Lines changed: 273 additions & 2282 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Build
2323
run: ./build.ps1
2424
- name: Upload artifacts
25-
uses: actions/upload-artifact@v3
25+
uses: actions/upload-artifact@v4
2626
with:
2727
path: |
2828
artifacts/*.nupkg

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2424
run: ./build.ps1 publish
2525
- name: Upload artifacts
26-
uses: actions/upload-artifact@v3
26+
uses: actions/upload-artifact@v4
2727
with:
2828
path: |
2929
artifacts/*.nupkg

build/build.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>

src/Machine.Specifications.Runner.ReSharper.Adapters/Discovery/Discoverer.cs

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,15 @@
1010

1111
namespace Machine.Specifications.Runner.ReSharper.Adapters.Discovery;
1212

13-
public class Discoverer
13+
public class Discoverer(
14+
TestRequest request,
15+
IMspecController controller,
16+
ITestDiscoverySink sink,
17+
RemoteTaskDepot depot,
18+
CancellationToken token)
1419
{
15-
private readonly TestRequest request;
16-
17-
private readonly IMspecController controller;
18-
19-
private readonly ITestDiscoverySink sink;
20-
21-
private readonly RemoteTaskDepot depot;
22-
23-
private readonly CancellationToken token;
24-
2520
private readonly ILogger logger = Logger.GetLogger<Discoverer>();
2621

27-
public Discoverer(TestRequest request, IMspecController controller, ITestDiscoverySink sink, RemoteTaskDepot depot, CancellationToken token)
28-
{
29-
this.request = request;
30-
this.controller = controller;
31-
this.sink = sink;
32-
this.depot = depot;
33-
this.token = token;
34-
}
35-
3622
public void Discover()
3723
{
3824
logger.Info($"Discovering tests from {request.Container.Location}");

src/Machine.Specifications.Runner.ReSharper.Adapters/Discovery/DiscoveryCache.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77

88
namespace Machine.Specifications.Runner.ReSharper.Adapters.Discovery;
99

10-
public class DiscoveryCache
10+
public class DiscoveryCache(Assembly assembly)
1111
{
12-
private readonly Assembly assembly;
13-
1412
private readonly Dictionary<string, Type?> types = new();
1513

1614
private readonly Dictionary<string, FieldInfo?> fields = new();
@@ -21,11 +19,6 @@ public class DiscoveryCache
2119

2220
private readonly Dictionary<string, IBehaviorElement> behaviors = new();
2321

24-
public DiscoveryCache(Assembly assembly)
25-
{
26-
this.assembly = assembly;
27-
}
28-
2922
public IBehaviorElement? GetOrAddBehavior(IContextElement context, SpecificationInfo specification)
3023
{
3124
var behaviorField = GetOrAddBehaviorFieldByType(context.TypeName, specification.ContainingType);

src/Machine.Specifications.Runner.ReSharper.Adapters/Discovery/MspecController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void Find(IMspecDiscoverySink sink, string assemblyPath)
3636
var assemblyName = AssemblyName.GetAssemblyName(assemblyPath);
3737
var assembly = Assembly.Load(assemblyName);
3838

39-
var results = (string) invoker.Invoke(controller, new object[] {assembly});
39+
var results = (string) invoker.Invoke(controller, [assembly]);
4040

4141
var specifications = GetSpecifications(assembly, results);
4242

src/Machine.Specifications.Runner.ReSharper.Adapters/Discovery/MspecDiscoverySink.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55

66
namespace Machine.Specifications.Runner.ReSharper.Adapters.Discovery;
77

8-
public class MspecDiscoverySink : IMspecDiscoverySink
8+
public class MspecDiscoverySink(CancellationToken token) : IMspecDiscoverySink
99
{
10-
private readonly CancellationToken token;
11-
1210
private readonly TaskCompletionSource<IMspecElement[]> source = new();
1311

1412
private readonly List<IMspecElement> elements = new();
@@ -21,11 +19,6 @@ public class MspecDiscoverySink : IMspecDiscoverySink
2119

2220
public Task<IMspecElement[]> Elements => source.Task;
2321

24-
public MspecDiscoverySink(CancellationToken token)
25-
{
26-
this.token = token;
27-
}
28-
2922
public void OnSpecification(ISpecificationElement specification)
3023
{
3124
token.ThrowIfCancellationRequested();
Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,17 @@
11
namespace Machine.Specifications.Runner.ReSharper.Adapters.Elements;
22

3-
public class BehaviorElement : IBehaviorElement
3+
public class BehaviorElement(IContextElement context, string typeName, string fieldName, string? ignoreReason)
4+
: IBehaviorElement
45
{
5-
public BehaviorElement(IContextElement context, string typeName, string fieldName, string? ignoreReason)
6-
{
7-
Id = $"{context.TypeName}.{fieldName}";
8-
AggregateId = $"{context.TypeName}.{typeName}";
9-
Context = context;
10-
TypeName = typeName;
11-
FieldName = fieldName;
12-
IgnoreReason = ignoreReason;
13-
}
6+
public string Id { get; } = $"{context.TypeName}.{fieldName}";
147

15-
public string Id { get; }
8+
public string AggregateId { get; } = $"{context.TypeName}.{typeName}";
169

17-
public string AggregateId { get; }
10+
public string? IgnoreReason { get; } = ignoreReason;
1811

19-
public string? IgnoreReason { get; }
12+
public IContextElement Context { get; } = context;
2013

21-
public IContextElement Context { get; }
14+
public string TypeName { get; } = typeName;
2215

23-
public string TypeName { get; }
24-
25-
public string FieldName { get; }
16+
public string FieldName { get; } = fieldName;
2617
}
Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
namespace Machine.Specifications.Runner.ReSharper.Adapters.Elements;
22

3-
public class ContextElement : IContextElement
3+
public class ContextElement(string typeName, string subject, string? ignoreReason) : IContextElement
44
{
5-
public ContextElement(string typeName, string subject, string? ignoreReason)
6-
{
7-
Id = typeName;
8-
TypeName = typeName;
9-
Subject = subject;
10-
IgnoreReason = ignoreReason;
11-
}
12-
13-
public string Id { get; }
5+
public string Id { get; } = typeName;
146

157
public string AggregateId => Id;
168

17-
public string? IgnoreReason { get; }
9+
public string? IgnoreReason { get; } = ignoreReason;
1810

19-
public string TypeName { get; }
11+
public string TypeName { get; } = typeName;
2012

21-
public string Subject { get; }
13+
public string Subject { get; } = subject;
2214
}
Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,25 @@
11
namespace Machine.Specifications.Runner.ReSharper.Adapters.Elements;
22

3-
public class SpecificationElement : ISpecificationElement
3+
public class SpecificationElement(
4+
IContextElement context,
5+
string fieldName,
6+
string? ignoreReason = null,
7+
IBehaviorElement? behavior = null)
8+
: ISpecificationElement
49
{
5-
public SpecificationElement(IContextElement context, string fieldName, string? ignoreReason = null, IBehaviorElement? behavior = null)
6-
{
7-
Id = behavior != null
8-
? $"{context.TypeName}.{behavior.FieldName}.{fieldName}"
9-
: $"{context.TypeName}.{fieldName}";
10-
AggregateId = behavior != null
11-
? $"{context.TypeName}.{behavior.TypeName}.{fieldName}"
12-
: $"{context.TypeName}.{fieldName}";
13-
IgnoreReason = ignoreReason;
14-
Context = context;
15-
FieldName = fieldName;
16-
Behavior = behavior;
17-
}
10+
public string Id { get; } = behavior != null
11+
? $"{context.TypeName}.{behavior.FieldName}.{fieldName}"
12+
: $"{context.TypeName}.{fieldName}";
1813

19-
public string Id { get; }
14+
public string AggregateId { get; } = behavior != null
15+
? $"{context.TypeName}.{behavior.TypeName}.{fieldName}"
16+
: $"{context.TypeName}.{fieldName}";
2017

21-
public string AggregateId { get; }
18+
public string? IgnoreReason { get; } = ignoreReason;
2219

23-
public string? IgnoreReason { get; }
20+
public IContextElement Context { get; } = context;
2421

25-
public IContextElement Context { get; }
22+
public string FieldName { get; } = fieldName;
2623

27-
public string FieldName { get; }
28-
29-
public IBehaviorElement? Behavior { get; }
24+
public IBehaviorElement? Behavior { get; } = behavior;
3025
}

0 commit comments

Comments
 (0)