Добавить тест

This commit is contained in:
Roman Efremov 2025-02-14 17:13:46 +05:00
parent 58346b8f3e
commit c4b9878105
3 changed files with 42 additions and 1 deletions

View File

@ -6,7 +6,7 @@ using System.Collections.Concurrent;
using System.Reflection;
namespace DD.Persistence.Client.Clients.Mapping.Clients;
internal class TimestampedMappingClient(ITimestampedValuesClient client, Dictionary<Guid, Type>? mappingConfigs) : ITimestampedMappingClient
public class TimestampedMappingClient(ITimestampedValuesClient client, Dictionary<Guid, Type>? mappingConfigs) : ITimestampedMappingClient
{
/// <inheritdoc/>
private readonly ConcurrentDictionary<Guid, TimestampedSetMapperBase> mapperCache = new();

View File

@ -16,6 +16,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DD.Persistence.Client\DD.Persistence.Client.csproj" />
<ProjectReference Include="..\DD.Persistence.Database.Postgres\DD.Persistence.Database.Postgres.csproj" />
</ItemGroup>

View File

@ -0,0 +1,40 @@
using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Client.Clients.Mapping.Abstractions;
using DD.Persistence.Client.Clients.Mapping.Clients;
using DD.Persistence.Repositories;
using DD.Persistence.Services.Interfaces;
using NSubstitute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DD.Persistence.Test;
public class MappingClientsTest
{
private readonly ITimestampedValuesClient timestampedValuesClient = Substitute.For<ITimestampedValuesClient>();
private readonly TimestampedMappingClient timestampedMappingClient;
public record TestDto
{
public int Id { get; set; }
public string? Value { get; set; }
}
private readonly Dictionary<Guid, Type> mappingConfigs = new Dictionary<Guid, Type>()
{
{ Guid.NewGuid(), typeof(TestDto) }
};
public MappingClientsTest()
{
timestampedMappingClient = new TimestampedMappingClient(timestampedValuesClient, mappingConfigs);
}
[Fact]
public async void Test()
{
var discriminatorIds = mappingConfigs.Keys;
var result = await timestampedMappingClient.Gett(discriminatorIds, null, null, null, 0, 1, CancellationToken.None);
}
}