defcee165a
* disable channels when skipping things * pass child closures to current. Current closures out to parent. * fix build * adjust options * use a dictionary pool and pool correctly * add pools for data chunks * format
48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
using System.Collections.Concurrent;
|
|
using Shouldly;
|
|
using Speckle.Newtonsoft.Json.Linq;
|
|
using Speckle.Sdk.Common;
|
|
using Speckle.Sdk.Dependencies.Serialization;
|
|
using Speckle.Sdk.Serialisation.V2;
|
|
using Speckle.Sdk.Serialisation.V2.Send;
|
|
using Speckle.Sdk.Transports;
|
|
|
|
namespace Speckle.Sdk.Serialization.Tests;
|
|
|
|
public class DummySendServerObjectManager(ConcurrentDictionary<string, string> savedObjects) : IServerObjectManager
|
|
{
|
|
public IAsyncEnumerable<(string, string)> DownloadObjects(
|
|
IReadOnlyCollection<string> objectIds,
|
|
IProgress<ProgressArgs>? progress,
|
|
CancellationToken cancellationToken
|
|
) => throw new NotImplementedException();
|
|
|
|
public Task<string?> DownloadSingleObject(
|
|
string objectId,
|
|
IProgress<ProgressArgs>? progress,
|
|
CancellationToken cancellationToken
|
|
) => throw new NotImplementedException();
|
|
|
|
public Task<Dictionary<string, bool>> HasObjects(
|
|
IReadOnlyCollection<string> objectIds,
|
|
CancellationToken cancellationToken
|
|
)
|
|
{
|
|
return Task.FromResult(objectIds.Distinct().ToDictionary(x => x, savedObjects.ContainsKey));
|
|
}
|
|
|
|
public Task UploadObjects(
|
|
IReadOnlyList<BaseItem> objects,
|
|
bool compressPayloads,
|
|
IProgress<ProgressArgs>? progress,
|
|
CancellationToken cancellationToken
|
|
)
|
|
{
|
|
foreach (var obj in objects)
|
|
{
|
|
savedObjects.TryAdd(obj.Id.Value, obj.Json.Value);
|
|
}
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|