bafd130ece
* snapshot testing with verify * formatting * add back old serialization tests * pass verify * use json correctly * formatting * Don't use Quibble and order ourselves because ordering doesn't matter * whitespace on snapshot * Better json diffing? Quibble is back * add common project * add object unit tests to see how verify would work * format * move random exes to new solution folder * update lock files
56 lines
1.5 KiB
C#
56 lines
1.5 KiB
C#
using System.Runtime.CompilerServices;
|
|
using System.Text;
|
|
using Speckle.Sdk.Serialisation.V2;
|
|
using Speckle.Sdk.Serialisation.V2.Send;
|
|
using Speckle.Sdk.Transports;
|
|
|
|
namespace Speckle.Sdk.Testing.Framework;
|
|
|
|
public class DummyReceiveServerObjectManager(Dictionary<string, string> objects) : IServerObjectManager
|
|
{
|
|
public async IAsyncEnumerable<(string, string)> DownloadObjects(
|
|
IReadOnlyCollection<string> objectIds,
|
|
IProgress<ProgressArgs>? progress,
|
|
[EnumeratorCancellation] CancellationToken cancellationToken
|
|
)
|
|
{
|
|
await Task.CompletedTask;
|
|
foreach (var id in objectIds)
|
|
{
|
|
yield return (id, objects[id]);
|
|
}
|
|
}
|
|
|
|
public async Task<string?> DownloadSingleObject(
|
|
string objectId,
|
|
IProgress<ProgressArgs>? progress,
|
|
CancellationToken cancellationToken
|
|
)
|
|
{
|
|
await Task.CompletedTask;
|
|
return objects[objectId];
|
|
}
|
|
|
|
public Task<Dictionary<string, bool>> HasObjects(
|
|
IReadOnlyCollection<string> objectIds,
|
|
CancellationToken cancellationToken
|
|
) => throw new NotImplementedException();
|
|
|
|
public Task UploadObjects(
|
|
IReadOnlyList<BaseItem> objects,
|
|
bool compressPayloads,
|
|
IProgress<ProgressArgs>? progress,
|
|
CancellationToken cancellationToken
|
|
)
|
|
{
|
|
long totalBytes = 0;
|
|
foreach (var item in objects)
|
|
{
|
|
totalBytes += Encoding.Default.GetByteCount(item.Json.Value);
|
|
}
|
|
|
|
progress?.Report(new(ProgressEvent.UploadBytes, totalBytes, totalBytes));
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|