Skip to content

Commit 09a87f9

Browse files
committed
drop support for dotnet 3
1 parent 8def3cd commit 09a87f9

File tree

11 files changed

+23
-61
lines changed

11 files changed

+23
-61
lines changed

.github/workflows/publish.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Setup .NET
3535
uses: actions/setup-dotnet@v4
3636
with:
37-
DOTNET_VERSION: 8.x
37+
DOTNET_VERSION: 6.x
3838

3939
- run: dotnet pack --configuration Release --output ${{ env.NuGetDirectory }}
4040

@@ -46,13 +46,14 @@ jobs:
4646
path: ${{ env.NuGetDirectory }}/*.nupkg
4747

4848
validate_nuget:
49+
name: Validate Nuget Package
4950
runs-on: ubuntu-latest
5051
needs: [ create_nuget ]
5152
steps:
5253
- name: Setup .NET
5354
uses: actions/setup-dotnet@v4
5455
with:
55-
DOTNET_VERSION: 8.x
56+
DOTNET_VERSION: 6.x
5657

5758
- uses: actions/download-artifact@v4
5859
with:
@@ -66,6 +67,7 @@ jobs:
6667
run: meziantou.validate-nuget-package (Get-ChildItem "${{ env.NuGetDirectory }}/*.nupkg")
6768

6869
run_test:
70+
name: Run Tests
6971
runs-on: ubuntu-latest
7072
steps:
7173
- name: Checkout
@@ -74,12 +76,13 @@ jobs:
7476
- name: Setup .NET
7577
uses: actions/setup-dotnet@v4
7678
with:
77-
DOTNET_VERSION: 8.x
79+
DOTNET_VERSION: 6.x
7880

7981
- name: Run tests
8082
run: dotnet test --configuration Release
8183

8284
deploy:
85+
name: Deploy Nuget Package
8386
if: github.event_name == 'release'
8487
runs-on: ubuntu-latest
8588
needs: [ validate_nuget, run_test ]
@@ -92,7 +95,7 @@ jobs:
9295
- name: Setup .NET Core
9396
uses: actions/setup-dotnet@v4
9497
with:
95-
DOTNET_VERSION: 8.x
98+
DOTNET_VERSION: 6.x
9699

97100
- name: Publish NuGet package
98101
run: |

PulumiTestHelper.Tests/Tests.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public async Task Should_Add_ResourceMockFunc(string imageUri)
9797
[Fact]
9898
public async Task Should_Add_ResourceMocks()
9999
{
100-
var result = await _baseStackBuilder.AddResourceMocks([
100+
var (resources, _) = await _baseStackBuilder.AddResourceMocks([
101101
new ResourceMock(typeof(Image),
102102
new Dictionary<string, object>
103103
{
@@ -108,11 +108,11 @@ public async Task Should_Add_ResourceMocks()
108108
{"repositoryUrl", "my-repository-url"}
109109
})
110110
]).BuildStackAsync<AwsStack>();
111-
112-
var image = result.Resources.OfType<Image>().Single(x => x.HasName("my-image"));
111+
112+
var image = resources.OfType<Image>().Single(x => x.HasName("my-image"));
113113
image.ImageUri.GetValue().Should().Be("my-image-uri");
114114

115-
var repository = result.Resources.OfType<Repository>().Single();
115+
var repository = resources.OfType<Repository>().Single();
116116
repository.RepositoryUrl.GetValue().Should().Be("my-repository-url");
117117
}
118118

PulumiTestHelper/Models/CallMock.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,4 @@
33
/// <summary>
44
/// Represents a mock for a function call.
55
/// </summary>
6-
public class CallMock(Type callType, Dictionary<string, object> mocks)
7-
{
8-
internal Type CallType { get; } = callType;
9-
internal Dictionary<string, object> Mocks { get; } = mocks;
10-
}
6+
public record CallMock(Type CallType, Dictionary<string, object> Mocks);

PulumiTestHelper/Models/CallMockFunc.cs

+1-6
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,4 @@ namespace PulumiTestHelper.Models;
55
/// <summary>
66
/// Represents a class that provides a way to define and manage call mock functions.
77
/// </summary>
8-
public class CallMockFunc(Type callType, Func<MockCallArgs, Dictionary<string, object>> mockFunc)
9-
{
10-
internal Type CallType { get; } = callType;
11-
12-
internal Func<MockCallArgs, Dictionary<string, object>> MockFunc { get; } = mockFunc;
13-
}
8+
public record CallMockFunc(Type CallType, Func<MockCallArgs, Dictionary<string, object>> MockFunc);

PulumiTestHelper/Models/ResourceInput.cs

+1-6
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,4 @@ namespace PulumiTestHelper.Models;
55
/// <summary>
66
/// Represents a resource input.
77
/// </summary>
8-
public class ResourceInput(string? identifier, ImmutableDictionary<string, object> inputs)
9-
{
10-
internal string? Identifier { get; } = identifier;
11-
12-
internal ImmutableDictionary<string, object> Inputs { get; } = inputs;
13-
}
8+
public record ResourceInput(string? Identifier, ImmutableDictionary<string, object> Inputs);

PulumiTestHelper/Models/ResourceMock.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,4 @@ namespace PulumiTestHelper.Models;
33
/// <summary>
44
/// Represents a mock for a Pulumi resource.
55
/// </summary>
6-
public class ResourceMock(Type resourceType, Dictionary<string, object> mocks)
7-
{
8-
internal Type ResourceType { get; } = resourceType;
9-
internal Dictionary<string, object> Mocks { get; set; } = mocks;
10-
}
6+
public record ResourceMock(Type ResourceType, Dictionary<string, object> Mocks);

PulumiTestHelper/Models/ResourceMockFunc.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,4 @@ namespace PulumiTestHelper.Models;
55
/// <summary>
66
/// Represents a resource mock function used for mocking resources in Pulumi tests.
77
/// </summary>
8-
public class ResourceMockFunc(Type resourceType, Func<MockResourceArgs, Dictionary<string, object>> mockFunc)
9-
{
10-
internal Type ResourceType { get; } = resourceType;
11-
internal Func<MockResourceArgs, Dictionary<string, object>> MockFunc { get; } = mockFunc;
12-
}
8+
public record ResourceMockFunc(Type ResourceType, Func<MockResourceArgs, Dictionary<string, object>> MockFunc);

PulumiTestHelper/Models/StackReferenceMock.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace PulumiTestHelper.Models;
55
/// <summary>
66
/// Represents a mock for a Pulumi stack reference.
77
/// </summary>
8-
public class StackReferenceMock : ResourceMock
8+
public record StackReferenceMock : ResourceMock
99
{
1010
/// <inheritdoc />
1111
public StackReferenceMock(string stackReferenceName, Dictionary<string, object> mocks) : base(

PulumiTestHelper/Models/StackResult.cs

+3-13
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,6 @@ namespace PulumiTestHelper.Models;
66
/// <summary>
77
/// Represents a result from building a stack.
88
/// </summary>
9-
/// <param name="resources">List of resources from the stack</param>
10-
/// <param name="resourceInputs">List of resource inputs from the stack</param>
11-
public class StackResult(ImmutableArray<Resource> resources, List<ResourceInput> resourceInputs)
12-
{
13-
/// <summary>
14-
/// List of resources from the stack.
15-
/// </summary>
16-
public ImmutableArray<Resource> Resources { get; } = resources;
17-
/// <summary>
18-
/// List of resource inputs from the stack.
19-
/// </summary>
20-
public List<ResourceInput> ResourceInputs { get; } = resourceInputs;
21-
}
9+
/// <param name="Resources">List of resources from the stack</param>
10+
/// <param name="ResourceInputs">List of resource inputs from the stack</param>
11+
public record StackResult(ImmutableArray<Resource> Resources, List<ResourceInput> ResourceInputs);

PulumiTestHelper/PulumiTestHelper.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net6;netcoreapp3.1</TargetFrameworks>
4+
<TargetFramework>net6</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<LangVersion>latest</LangVersion>

readme.md

+2-11
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,8 @@ public async Task<StackResult> BuildStackAsync<T>(IServiceProvider serviceProvid
3131
```
3232
#### Example:
3333
```c#
34-
var result = await new StackBuilder().BuildStackAsync<MyStack>();
35-
36-
var resources = result.Resources;
37-
var resourceInputs = result.ResourceInputs;
38-
```
39-
40-
```c#
41-
var result = await new StackBuilder().BuildStackAsync<MyStack>(serviceProvider);
42-
43-
var resources = result.Resources;
44-
var resourceInputs = result.ResourceInputs;
34+
var (resources, resourceInputs) = await new StackBuilder().BuildStackAsync<MyStack>();
35+
var (resources, resourceInputs) = await new StackBuilder().BuildStackAsync<MyStack>(serviceProvider);
4536
```
4637

4738
## Add Mocks for all resources

0 commit comments

Comments
 (0)