Files
speckle-sharp-sdk/tests/Speckle.Sdk.Serialization.Tests/Framework/TestTransport.cs
T
Adam Hathcock 3aa993cecb Add cancellation tests (#218)
* Don't log cancelling

* redo exception handling for receive

* remove null test case

* clean up with Id/Json and more cancels

* Change the exception stacks

* fix serialization test

* make a custom scrubber for internalized exceptions

* clean up

* fix namespaces again :(

* adjust the scrubber

* try to make tests more predictable

* rework exceptions again

* strip out compile files used

* formatting

* custom exception validation

* fix init

* Move serialization to own class

* save serialize test

* add deep clean

* add cancellation test on save to cache

* cancellation tests

* format

* do DI correctly

* receive cancel works
2025-01-30 13:42:15 +00:00

36 lines
1.2 KiB
C#

using Speckle.Sdk.Transports;
namespace Speckle.Sdk.Serialization.Tests.Framework;
public class TestTransport(IReadOnlyDictionary<string, string> objects) : ITransport
{
public string TransportName
{
get => "Test";
set { }
}
public Dictionary<string, object> TransportContext { get; }
public TimeSpan Elapsed { get; }
public int SavedObjectCount { get; }
public CancellationToken CancellationToken { get; set; }
public IProgress<ProgressArgs>? OnProgressAction { get; set; }
public Action<string, Exception>? OnErrorAction { get; set; }
public void BeginWrite() => throw new NotImplementedException();
public void EndWrite() => throw new NotImplementedException();
public void SaveObject(string id, string serializedObject) => throw new NotImplementedException();
public Task WriteComplete() => throw new NotImplementedException();
public Task<string?> GetObject(string id) => Task.FromResult(objects.GetValueOrDefault(id));
public Task<string> CopyObjectAndChildren(string id, ITransport targetTransport) =>
throw new NotImplementedException();
public Task<Dictionary<string, bool>> HasObjects(IReadOnlyList<string> objectIds) =>
throw new NotImplementedException();
}