Files
speckle-sharp-sdk/tests/Speckle.Sdk.Tests.Unit/Serialisation/SimpleRoundTripTests.cs
T
Adam Hathcock d305fe59cb feat(sdk) clean up registration of sdk to not be connector specific (#274)
* First pass of ObjectSaver and better in-memory usage

* fix some tests

* add commit to match deserialize process

* correct more tests

* format

* make a deserialize factory

* fix tests? and format

* use distinct

* Fix mismerge

* Fix serialization issues with tests

* fix merges

* follow copilot suggestions

* remove disables

* change registration to take strings and TypeLoader isn't public

* remove unused transports

* more test fixes

* fmt

* add Application object back
2025-04-08 09:49:31 +00:00

43 lines
1.1 KiB
C#

using FluentAssertions;
using Microsoft.Extensions.DependencyInjection;
using Speckle.Sdk.Api;
using Speckle.Sdk.Models;
using Speckle.Sdk.Tests.Unit.Host;
namespace Speckle.Sdk.Tests.Unit.Serialisation;
public class SimpleRoundTripTests
{
private readonly IOperations _operations;
public SimpleRoundTripTests()
{
var serviceProvider = TestServiceSetup.GetServiceProvider();
_operations = serviceProvider.GetRequiredService<IOperations>();
}
public static IEnumerable<object[]> TestData() => TestDataInternal().Select(x => new object[] { x });
public static IEnumerable<Base> TestDataInternal()
{
yield return new DiningTable { ["@strangeVariable_NAme3"] = new TableLegFixture() };
var polyline = new Polyline();
for (int i = 0; i < 100; i++)
{
polyline.Points.Add(new Point { X = i * 2, Y = i % 2 });
}
yield return polyline;
}
[Theory]
[MemberData(nameof(TestData))]
public async Task SimpleSerialization(Base testData)
{
var result = _operations.Serialize(testData);
var test = await _operations.DeserializeAsync(result);
testData.GetId().Should().Be(test.GetId());
}
}