Skip to content

Commit

Permalink
Update project to .NET 8
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Chang <[email protected]>
  • Loading branch information
mocsharp committed Dec 20, 2023
1 parent b700454 commit 5bd7d9d
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 109 deletions.
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0.100",
"version": "8.0.100",
"rollForward": "latestFeature"
}
}
6 changes: 0 additions & 6 deletions src/Messaging/Common/LoggingDataDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,15 @@
*/

using System.Globalization;
using System.Runtime.Serialization;

namespace Monai.Deploy.Messaging.Common
{
[Serializable]
public class LoggingDataDictionary<TKey, TValue> : Dictionary<TKey, TValue> where TKey : notnull
{
public LoggingDataDictionary()
{
}

protected LoggingDataDictionary(SerializationInfo info, StreamingContext context) : base(info, context)
{
}

public override string ToString()
{
var pairs = this.Select(x => string.Format(CultureInfo.InvariantCulture, "{0}={1}", x.Key, x.Value));
Expand Down
8 changes: 0 additions & 8 deletions src/Messaging/Common/MessageConversionException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@
* limitations under the License.
*/

//
using System.Runtime.Serialization;

namespace Monai.Deploy.Messaging.Common
{
[Serializable]
public class MessageConversionException : Exception
{
public MessageConversionException()
Expand All @@ -33,9 +29,5 @@ public MessageConversionException(string message) : base(message)
public MessageConversionException(string message, Exception innerException) : base(message, innerException)
{
}

protected MessageConversionException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}
6 changes: 0 additions & 6 deletions src/Messaging/Common/MessageValidationException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,16 @@
*/

using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;

namespace Monai.Deploy.Messaging.Common
{
[Serializable]
public class MessageValidationException : Exception
{
public MessageValidationException(List<ValidationResult> errors)
: base(FormatMessage(errors))
{
}

protected MessageValidationException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}

private static string FormatMessage(List<ValidationResult> errors)
{
if (errors is null || errors.Count == 0)
Expand Down
6 changes: 0 additions & 6 deletions src/Messaging/Common/ServiceException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*/

using System.Runtime.Serialization;

namespace Monai.Deploy.Messaging.Common
{
public class ServiceException : Exception
Expand All @@ -31,9 +29,5 @@ public ServiceException(string? message) : base(message)
public ServiceException(string? message, Exception? innerException) : base(message, innerException)
{
}

protected ServiceException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}
7 changes: 0 additions & 7 deletions src/Messaging/Configuration/ConfigurationException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,12 @@
* limitations under the License.
*/

using System.Runtime.Serialization;

namespace Monai.Deploy.Messaging.Configuration
{
[Serializable]
public class ConfigurationException : Exception
{
public ConfigurationException(string? message) : base(message)
{
}

protected ConfigurationException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}
20 changes: 5 additions & 15 deletions src/Messaging/Monai.Deploy.Messaging.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,16 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<CodeAnalysisRuleSet>..\.sonarlint\project-monai_monai-deploy-messagingcsharp.ruleset</CodeAnalysisRuleSet>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<PropertyGroup>
<PackageId>Monai.Deploy.Messaging</PackageId>
<Version>0.1.0</Version>
Expand All @@ -39,45 +37,37 @@
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\LICENSE" Link="LICENSE" PackagePath="" Pack="true" />
<None Include="..\..\third-party-licenses.md" Link="third-party-licenses.md" PackagePath="" Pack="true" />
</ItemGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<LangVersion>preview</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<LangVersion>preview</LangVersion>
</PropertyGroup>

<ItemGroup>
<AdditionalFiles Include="..\.sonarlint\project-monai_monai-deploy-messaging\CSharp\SonarLint.xml" Link="SonarLint.xml" />
</ItemGroup>

<ItemGroup>
<Compile Remove="Tests\**" />
<EmbeddedResource Remove="Tests\**" />
<None Remove="Tests\**" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\AssemblyInfo.cs" Link="AssemblyInfo.cs" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Ardalis.GuardClauses" Version="4.1.1" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="6.0.21" />
<PackageReference Include="Ardalis.GuardClauses" Version="4.2.0" />
<PackageReference Include="System.IO.Abstractions" Version="20.0.4" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.IO.Abstractions" Version="17.2.3" />
</ItemGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion src/Messaging/Tests/Common/ArtifactTypesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void ArtifactTypeInvalid_ShouldReturnFalse()
[Fact]
public void ArtifactTypeNull_ShouldReturnFalse()
{
Assert.False(ArtifactTypes.Validate(null));
Assert.False(ArtifactTypes.Validate(null!));
}

[Fact]
Expand Down
22 changes: 7 additions & 15 deletions src/Messaging/Tests/Monai.Deploy.Messaging.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,33 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<LangVersion>preview</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<LangVersion>preview</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0" />
<PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="17.2.3" />
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="20.0.4" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Monai.Deploy.Messaging.csproj" />
</ItemGroup>

</Project>
</Project>
18 changes: 4 additions & 14 deletions src/Plugins/RabbitMQ/Monai.Deploy.Messaging.RabbitMQ.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,16 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<RootNamespace>Monai.Deploy.Messaging.RabbitMQ</RootNamespace>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<PropertyGroup>
<PackageId>Monai.Deploy.Messaging.RabbitMQ</PackageId>
<Version>0.1.0</Version>
Expand All @@ -39,36 +36,29 @@
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\..\LICENSE" Link="LICENSE" PackagePath="" Pack="true" />
<None Include="..\..\..\third-party-licenses.md" Link="third-party-licenses.md" PackagePath="" Pack="true" />
</ItemGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<LangVersion>preview</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<LangVersion>preview</LangVersion>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Tests\**" />
<EmbeddedResource Remove="Tests\**" />
<None Remove="Tests\**" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\..\AssemblyInfo.cs" Link="AssemblyInfo.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Polly" Version="7.2.4" />
<PackageReference Include="RabbitMQ.Client" Version="6.5.0" />
<PackageReference Include="Polly" Version="8.2.0" />
<PackageReference Include="RabbitMQ.Client" Version="6.8.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Messaging\Monai.Deploy.Messaging.csproj" />
</ItemGroup>
</Project>
</Project>
4 changes: 2 additions & 2 deletions src/Plugins/RabbitMQ/Tests/Integration/HealthCheckTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ public HealthCheckTest()
[Fact]
public async Task GivenAWebServer_WhenRabbitMqHealthChecksAreRegistered_ExpectToReturnInfoFromHealthEndpoint()
{
using var host = await new HostBuilder().ConfigureWebHost(SetupWebServer()).StartAsync().ConfigureAwait(false);
using var host = await new HostBuilder().ConfigureWebHost(SetupWebServer()).StartAsync();

var server = host.GetTestServer();
server.BaseAddress = new Uri("https://example.com/");

var client = server.CreateClient();
var responseMessage = await client.GetAsync("health").ConfigureAwait(false);
var responseMessage = await client.GetAsync("health");

Assert.Equal(HttpStatusCode.OK, responseMessage.StatusCode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,48 +13,39 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<LangVersion>preview</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<LangVersion>preview</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.21" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0" />
<PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="17.2.3" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="20.0.4" />
<PackageReference Include="xunit" Version="2.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\Messaging\Monai.Deploy.Messaging.csproj" />
<ProjectReference Include="..\Monai.Deploy.Messaging.RabbitMQ.csproj" />
</ItemGroup>

</Project>
</Project>
4 changes: 2 additions & 2 deletions src/Plugins/RabbitMQ/Tests/Unit/RabbitMQHealthCheckTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public async Task CheckHealthAsync_WhenFailed_ReturnUnhealthy()
.Throws(new Exception("error"));

var healthCheck = new RabbitMQHealthCheck(_connectionFactory.Object, _options, _logger.Object, (d) => { });
var results = await healthCheck.CheckHealthAsync(new HealthCheckContext()).ConfigureAwait(false);
var results = await healthCheck.CheckHealthAsync(new HealthCheckContext());

Assert.Equal(HealthStatus.Unhealthy, results.Status);
Assert.NotNull(results.Exception);
Expand All @@ -61,7 +61,7 @@ public async Task CheckHealthAsync_WhenSucceeds_ReturnHealthy()
_connectionFactory.Setup(p => p.CreateChannel(It.IsAny<ChannelType>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()))
.Returns(channel.Object);
var healthCheck = new RabbitMQHealthCheck(_connectionFactory.Object, _options, _logger.Object, (d) => { });
var results = await healthCheck.CheckHealthAsync(new HealthCheckContext()).ConfigureAwait(false);
var results = await healthCheck.CheckHealthAsync(new HealthCheckContext());

Assert.Equal(HealthStatus.Healthy, results.Status);
Assert.Null(results.Exception);
Expand Down
Loading

0 comments on commit 5bd7d9d

Please sign in to comment.