Skip to content

Commit 06fa8a8

Browse files
authored
(#434) Updated all libraries for .NET 10 compatibility (#435)
* (#434) Update Automapper to v16.0.0 (.NET 10 compatibility) * (#434) Updates all other packages to .NET 10 compatible packages
1 parent 58f5f5f commit 06fa8a8

File tree

3 files changed

+43
-7
lines changed

3 files changed

+43
-7
lines changed

Directory.Packages.props

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
<ODataVersion>8.4.3</ODataVersion>
1111
</PropertyGroup>
1212
<ItemGroup>
13-
<PackageVersion Include="AutoMapper" Version="13.0.1" />
13+
<PackageVersion Include="AutoMapper" Version="16.0.0" />
1414
<PackageVersion Include="AwesomeAssertions" Version="9.3.0" />
1515
<PackageVersion Include="Azure.Identity" Version="1.17.1" />
1616
<PackageVersion Include="LiteDB" Version="5.0.21" />
1717
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="$(DotNetVersion)" />
1818
<PackageVersion Include="Microsoft.AspNetCore.OData" Version="9.4.1" />
1919
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="$(DotNetVersion)" />
20-
<PackageVersion Include="Microsoft.Azure.Cosmos" Version="3.56.0" />
20+
<PackageVersion Include="Microsoft.Azure.Cosmos" Version="3.57.0" />
2121
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="$(EFCoreVersion)" />
2222
<PackageVersion Include="Microsoft.EntityFrameworkCore.Cosmos" Version="$(EFCoreVersion)" />
2323
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="$(EFCoreVersion)" />
@@ -31,10 +31,11 @@
3131
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="$(DotNetVersion)" />
3232
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
3333
<PackageVersion Include="Microsoft.OData.Core" Version="$(ODataVersion)" />
34-
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
34+
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="10.0.103" />
3535
<PackageVersion Include="Microsoft.Spatial" Version="8.4.3" />
36+
<PackageVersion Include="MicrosoftExtensions.Logging.Xunit" Version="1.2.1" />
3637
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
37-
<PackageVersion Include="MongoDB.Driver" Version="3.5.2" />
38+
<PackageVersion Include="MongoDB.Driver" Version="3.6.0" />
3839
<PackageVersion Include="NSubstitute" Version="5.3.0" />
3940
<PackageVersion Include="NSwag.AspNetCore" Version="14.6.3" />
4041
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />

tests/CommunityToolkit.Datasync.Server.Automapper.Test/CommunityToolkit.Datasync.Server.Automapper.Test.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@
1717
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1818
<PrivateAssets>all</PrivateAssets>
1919
</PackageReference>
20+
<PackageReference Include="MicrosoftExtensions.Logging.Xunit"/>
2021
</ItemGroup>
2122
</Project>

tests/CommunityToolkit.Datasync.Server.Automapper.Test/MappedTableRepository_Tests.cs

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,33 @@
88
using CommunityToolkit.Datasync.TestCommon;
99
using CommunityToolkit.Datasync.TestCommon.Databases;
1010
using Microsoft.EntityFrameworkCore;
11+
using Microsoft.Extensions.Logging;
12+
using Microsoft.Extensions.Logging.Xunit;
1113
using Xunit.Abstractions;
1214

1315
namespace CommunityToolkit.Datasync.Server.Automapper.Test;
1416

1517
[ExcludeFromCodeCoverage]
16-
public class MappedTableRepository_Tests(ITestOutputHelper output) : RepositoryTests<MovieDto>()
18+
public class MappedTableRepository_Tests : RepositoryTests<MovieDto>, IDisposable
1719
{
1820
#region Setup
21+
private readonly ITestOutputHelper output;
1922
private readonly Random random = new();
2023
private SqliteDbContext context;
2124
private EntityTableRepository<SqliteEntityMovie> innerRepository;
22-
private readonly IMapper mapper = new MapperConfiguration(c => c.AddProfile(new MapperProfile())).CreateMapper();
25+
private readonly ILoggerFactory loggerFactory;
26+
private readonly IMapper mapper;
2327
private MappedTableRepository<SqliteEntityMovie, MovieDto> repository;
2428
private List<MovieDto> movies;
29+
private bool _disposedValue;
30+
31+
public MappedTableRepository_Tests(ITestOutputHelper output)
32+
{
33+
this.output = output;
34+
this.loggerFactory = new LoggerFactory([ new XunitLoggerProvider(this.output) ]);
35+
MapperConfiguration config = new(c => c.AddProfile(new MapperProfile()), this.loggerFactory);
36+
this.mapper = config.CreateMapper();
37+
}
2538

2639
protected override Task<MovieDto> GetEntityAsync(string id)
2740
=> Task.FromResult(this.mapper.Map<MovieDto>(this.context.Movies.AsNoTracking().SingleOrDefault(m => m.Id == id)));
@@ -31,7 +44,7 @@ protected override Task<int> GetEntityCountAsync()
3144

3245
protected override Task<IRepository<MovieDto>> GetPopulatedRepositoryAsync()
3346
{
34-
this.context = SqliteDbContext.CreateContext(output);
47+
this.context = SqliteDbContext.CreateContext(this.output);
3548
this.innerRepository = new EntityTableRepository<SqliteEntityMovie>(this.context);
3649
this.repository = new MappedTableRepository<SqliteEntityMovie, MovieDto>(this.mapper, this.innerRepository);
3750
this.movies = this.context.Movies.AsNoTracking().ToList().ConvertAll(m => this.mapper.Map<MovieDto>(m));
@@ -40,5 +53,26 @@ protected override Task<IRepository<MovieDto>> GetPopulatedRepositoryAsync()
4053

4154
protected override Task<string> GetRandomEntityIdAsync(bool exists)
4255
=> Task.FromResult(exists ? this.movies[this.random.Next(this.movies.Count)].Id : Guid.NewGuid().ToString());
56+
57+
protected virtual void Dispose(bool disposing)
58+
{
59+
if (!this._disposedValue)
60+
{
61+
if (disposing)
62+
{
63+
this.context.Dispose();
64+
this.loggerFactory.Dispose();
65+
}
66+
67+
this._disposedValue = true;
68+
}
69+
}
70+
71+
public void Dispose()
72+
{
73+
// Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
74+
Dispose(disposing: true);
75+
GC.SuppressFinalize(this);
76+
}
4377
#endregion
4478
}

0 commit comments

Comments
 (0)