Skip to content

Commit 1e95df6

Browse files
authored
Upgrade (#202)
* .net 10 upgrade
1 parent 1490d9e commit 1e95df6

23 files changed

Lines changed: 1146 additions & 1080 deletions

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
workflow_dispatch:
99

1010
env:
11-
DOTNET_VERSION: 7.0.x
11+
DOTNET_VERSION: 10.0.x
1212
SOLUTION_PATH: ./src/AzureEventGridSimulator.sln
1313
CONFIGURATION: Release
1414

@@ -24,7 +24,7 @@ jobs:
2424
- os: ubuntu-latest
2525
runtime: linux-x64
2626
- os: macos-latest
27-
runtime: osx-x64
27+
runtime: osx-arm64
2828
env:
2929
DOTNET_CLI_TELEMETRY_OPTOUT: 1
3030
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
env:
1515
VERSION_NUMBER: ${{ github.event.inputs.tag_name }}
1616
BUILD_NUMBER: ${{ github.event.inputs.tag_name }}.${{ github.run_number }}
17-
DOTNET_VERSION: 7.0.x
17+
DOTNET_VERSION: 10.0.x
1818
SOLUTION_PATH: ./src/AzureEventGridSimulator.sln
1919
PROJECT_PATH: ./src/AzureEventGridSimulator/AzureEventGridSimulator.csproj
2020
CONFIGURATION: Release
@@ -32,7 +32,7 @@ jobs:
3232
- os: ubuntu-latest
3333
runtime: linux-x64
3434
- os: macos-latest
35-
runtime: osx-x64
35+
runtime: osx-arm64
3636
env:
3737
DOTNET_CLI_TELEMETRY_OPTOUT: 1
3838
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,3 +351,5 @@ RunDockerContainer.bat
351351
BuildDockerImage.bat
352352
my.env
353353
.DS_Store
354+
.sonarqube
355+
.scannerwork

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# start with an sdk enabled alpine image so we can build source
2-
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0-alpine as build
2+
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0-alpine as build
33
WORKDIR /source
44

55
# copy source
@@ -13,7 +13,7 @@ RUN arch=$TARGETARCH \
1313
# build source and publish as single file called 'AzureEventGridSimulator'
1414
RUN dotnet publish -c release -o /artifact \
1515
-r alpine-$(cat /tmp/arch) \
16-
-f net7.0 \
16+
-f net10.0 \
1717
-v q \
1818
--nologo \
1919
--self-contained true \
@@ -24,7 +24,7 @@ RUN dotnet publish -c release -o /artifact \
2424
-p:TrimUnusedDependencies=true
2525

2626
# add binary artifact to new runtime-deps only image
27-
FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/runtime-deps:7.0-alpine
27+
FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/runtime-deps:10.0-alpine
2828
WORKDIR /app
2929

3030
# add tzdata incase we want to set the timezone

global.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"sdk": {
3+
"version": "10.0.100",
4+
"rollForward": "latestFeature",
5+
"allowPrerelease": false
6+
}
7+
}

src/AzureEventGridSimulator.Tests/AzureEventGridSimulator.Tests.csproj

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
5-
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
64
<IsPackable>false</IsPackable>
5+
<IsTestProject>true</IsTestProject>
76
</PropertyGroup>
87

98
<ItemGroup>
10-
<PackageReference Include="Azure.Messaging.EventGrid" Version="4.21.0" />
11-
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.13" />
12-
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
13-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
14-
<PackageReference Include="Shouldly" Version="4.2.1" />
15-
<PackageReference Include="xunit" Version="2.6.1" />
16-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
9+
<PackageReference Include="Azure.Messaging.EventGrid" />
10+
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" />
11+
<PackageReference Include="Newtonsoft.Json" />
12+
<PackageReference Include="Shouldly" />
13+
<PackageReference Include="Microsoft.NET.Test.Sdk" />
14+
<PackageReference Include="xunit" />
15+
<PackageReference Include="xunit.runner.visualstudio">
16+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1717
<PrivateAssets>all</PrivateAssets>
18+
</PackageReference>
19+
<PackageReference Include="coverlet.collector">
1820
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
21+
<PrivateAssets>all</PrivateAssets>
1922
</PackageReference>
2023
</ItemGroup>
2124

Lines changed: 88 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,88 @@
1-
using System;
2-
using AzureEventGridSimulator.Domain.Entities;
3-
using AzureEventGridSimulator.Infrastructure.Extensions;
4-
using AzureEventGridSimulator.Infrastructure.Settings;
5-
using Shouldly;
6-
using Xunit;
7-
8-
namespace AzureEventGridSimulator.Tests.UnitTests.Filtering;
9-
10-
[Trait("Category", "unit")]
11-
public class AdvancedFilterEventAcceptanceTests
12-
{
13-
private static readonly EventGridEvent _gridEvent = new()
14-
{
15-
Id = "EventId",
16-
Data = new { NumberValue = 1, IsTrue = true, Name = "StringValue", DoubleValue = 0.12345d, NumberMaxValue = ulong.MaxValue, SubObject = new { Id = 1, Name = "Test" } },
17-
DataVersion = "5.0",
18-
EventTime = DateTime.UtcNow.ToString("O"),
19-
EventType = "this.is.a.test.event.type",
20-
MetadataVersion = "2.3.4",
21-
Subject = "TheEventSubject",
22-
Topic = "THE_EVENT_TOPIC"
23-
};
24-
25-
[Theory]
26-
[ClassData(typeof(PositiveFilterTestCaseContainer))]
27-
public void TestAdvancedFilteringSuccess(AdvancedFilterSetting filter)
28-
{
29-
var filterConfig = new FilterSetting { AdvancedFilters = new[] { filter } };
30-
31-
filterConfig.AcceptsEvent(_gridEvent).ShouldBeTrue($"{filter.Key} - {filter.OperatorType} - {filter.Value} - {filter.Values.Separate()}");
32-
}
33-
34-
[Theory]
35-
[ClassData(typeof(NegativeFilterTestCaseContainer))]
36-
public void TestAdvancedFilteringFailure(AdvancedFilterSetting filter)
37-
{
38-
var filterConfig = new FilterSetting { AdvancedFilters = new[] { filter } };
39-
40-
filterConfig.AcceptsEvent(_gridEvent).ShouldBeFalse($"{filter.Key} - {filter.OperatorType} - {filter.Value} - {filter.Values.Separate()}");
41-
}
42-
43-
[Fact]
44-
public void TestSimpleEventDataFilteringSuccess()
45-
{
46-
var filterConfig = new FilterSetting
47-
{
48-
AdvancedFilters = new[]
49-
{
50-
new AdvancedFilterSetting { Key = "Data", OperatorType = AdvancedFilterSetting.OperatorTypeEnum.NumberIn, Values = new object[] { 1 } }
51-
}
52-
};
53-
var gridEvent = new EventGridEvent { Data = 1 };
54-
55-
filterConfig.AcceptsEvent(gridEvent).ShouldBeTrue();
56-
}
57-
58-
[Fact]
59-
public void TestSimpleEventDataFilteringUsingValueSuccess()
60-
{
61-
var filterConfig = new FilterSetting
62-
{
63-
AdvancedFilters = new[]
64-
{
65-
new AdvancedFilterSetting { Key = "Data", OperatorType = AdvancedFilterSetting.OperatorTypeEnum.NumberGreaterThanOrEquals, Value = 1 },
66-
new AdvancedFilterSetting { Key = "Data", OperatorType = AdvancedFilterSetting.OperatorTypeEnum.NumberLessThanOrEquals, Value = 1 }
67-
}
68-
};
69-
var gridEvent = new EventGridEvent { Data = 1 };
70-
71-
filterConfig.AcceptsEvent(gridEvent).ShouldBeTrue();
72-
}
73-
74-
[Fact]
75-
public void TestSimpleEventDataFilteringFailure()
76-
{
77-
var filterConfig = new FilterSetting
78-
{
79-
AdvancedFilters = new[]
80-
{
81-
new AdvancedFilterSetting { Key = "Data", OperatorType = AdvancedFilterSetting.OperatorTypeEnum.NumberIn, Value = 1 }
82-
}
83-
};
84-
var gridEvent = new EventGridEvent { Data = 1 };
85-
86-
filterConfig.AcceptsEvent(gridEvent).ShouldBeFalse();
87-
}
88-
}
1+
using System;
2+
using AzureEventGridSimulator.Domain.Entities;
3+
using AzureEventGridSimulator.Infrastructure.Extensions;
4+
using AzureEventGridSimulator.Infrastructure.Settings;
5+
using Shouldly;
6+
using Xunit;
7+
8+
namespace AzureEventGridSimulator.Tests.UnitTests.Filtering;
9+
10+
[Trait("Category", "unit")]
11+
public class AdvancedFilterEventAcceptanceTests
12+
{
13+
private static readonly EventGridEvent _gridEvent = new()
14+
{
15+
Id = "EventId",
16+
Data = new { NumberValue = 1, IsTrue = true, Name = "StringValue", DoubleValue = 0.12345d, NumberMaxValue = ulong.MaxValue, SubObject = new { Id = 1, Name = "Test" } },
17+
DataVersion = "5.0",
18+
EventTime = DateTime.UtcNow.ToString("O"),
19+
EventType = "this.is.a.test.event.type",
20+
MetadataVersion = "2.3.4",
21+
Subject = "TheEventSubject",
22+
Topic = "THE_EVENT_TOPIC"
23+
};
24+
25+
[Theory]
26+
[ClassData(typeof(PositiveFilterTestCaseContainer))]
27+
public void TestAdvancedFilteringSuccess(AdvancedFilterSetting filter)
28+
{
29+
var filterConfig = new FilterSetting { AdvancedFilters = new[] { filter } };
30+
31+
filterConfig.AcceptsEvent(_gridEvent).ShouldBeTrue($"{filter.Key} - {filter.OperatorType} - {filter.Value} - {filter.Values.Separate()}");
32+
}
33+
34+
[Theory]
35+
[ClassData(typeof(NegativeFilterTestCaseContainer))]
36+
public void TestAdvancedFilteringFailure(AdvancedFilterSetting filter)
37+
{
38+
var filterConfig = new FilterSetting { AdvancedFilters = new[] { filter } };
39+
40+
filterConfig.AcceptsEvent(_gridEvent).ShouldBeFalse($"{filter.Key} - {filter.OperatorType} - {filter.Value} - {filter.Values.Separate()}");
41+
}
42+
43+
[Fact]
44+
public void TestSimpleEventDataFilteringSuccess()
45+
{
46+
var filterConfig = new FilterSetting
47+
{
48+
AdvancedFilters = new[]
49+
{
50+
new AdvancedFilterSetting { Key = "Data", OperatorType = AdvancedFilterSetting.AdvancedFilterOperatorType.NumberIn, Values = new object[] { 1 } }
51+
}
52+
};
53+
var gridEvent = new EventGridEvent { Data = 1 };
54+
55+
filterConfig.AcceptsEvent(gridEvent).ShouldBeTrue();
56+
}
57+
58+
[Fact]
59+
public void TestSimpleEventDataFilteringUsingValueSuccess()
60+
{
61+
var filterConfig = new FilterSetting
62+
{
63+
AdvancedFilters = new[]
64+
{
65+
new AdvancedFilterSetting { Key = "Data", OperatorType = AdvancedFilterSetting.AdvancedFilterOperatorType.NumberGreaterThanOrEquals, Value = 1 },
66+
new AdvancedFilterSetting { Key = "Data", OperatorType = AdvancedFilterSetting.AdvancedFilterOperatorType.NumberLessThanOrEquals, Value = 1 }
67+
}
68+
};
69+
var gridEvent = new EventGridEvent { Data = 1 };
70+
71+
filterConfig.AcceptsEvent(gridEvent).ShouldBeTrue();
72+
}
73+
74+
[Fact]
75+
public void TestSimpleEventDataFilteringFailure()
76+
{
77+
var filterConfig = new FilterSetting
78+
{
79+
AdvancedFilters = new[]
80+
{
81+
new AdvancedFilterSetting { Key = "Data", OperatorType = AdvancedFilterSetting.AdvancedFilterOperatorType.NumberIn, Value = 1 }
82+
}
83+
};
84+
var gridEvent = new EventGridEvent { Data = 1 };
85+
86+
filterConfig.AcceptsEvent(gridEvent).ShouldBeFalse();
87+
}
88+
}

0 commit comments

Comments
 (0)