48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
using System.Security.Cryptography;
|
|
|
|
using FrostFS.SDK.Client.Interfaces;
|
|
using FrostFS.SDK.Cryptography;
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
namespace FrostFS.SDK.Tests.Unit;
|
|
|
|
public abstract class SessionTestsBase
|
|
{
|
|
internal readonly string key = "KwHDAJ66o8FoLBjVbjP2sWBmgBMGjt7Vv4boA7xQrBoAYBE397Aq";
|
|
|
|
protected IOptions<ClientSettings> Settings { get; set; }
|
|
|
|
protected ECDsa ECDsaKey { get; set; }
|
|
protected FrostFsOwner OwnerId { get; set; }
|
|
protected SessionMocker Mocker { get; set; }
|
|
|
|
protected SessionTestsBase()
|
|
{
|
|
Settings = Options.Create(new ClientSettings
|
|
{
|
|
Key = key,
|
|
Host = "http://localhost:8080"
|
|
});
|
|
|
|
ECDsaKey = key.LoadWif();
|
|
OwnerId = FrostFsOwner.FromKey(ECDsaKey);
|
|
|
|
Mocker = new SessionMocker(key)
|
|
{
|
|
PlacementPolicy = new FrostFsPlacementPolicy(true, new FrostFsReplica(1)),
|
|
Version = new FrostFsVersion(2, 13)
|
|
};
|
|
}
|
|
|
|
protected IFrostFSClient GetClient()
|
|
{
|
|
return Client.FrostFSClient.GetTestInstance(
|
|
Settings,
|
|
(url) => Grpc.Net.Client.GrpcChannel.ForAddress(new Uri(url)),
|
|
new NetworkMocker(key).GetMock().Object,
|
|
Mocker.GetMock().Object,
|
|
new ContainerMocker(key).GetMock().Object,
|
|
new ObjectMocker(key).GetMock().Object);
|
|
}
|
|
}
|