00a6619cbe
.NET Build and Publish / build (push) Has been cancelled
* Add permission checks and deprecate canPublish * Fix tests * How's this * make tests more reliable * lets test this first * test * This should speed up unit tests * skip slow tests * I HATE flaky tests
46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
using FluentAssertions;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Speckle.Sdk.Api;
|
|
using Speckle.Sdk.Host;
|
|
using Speckle.Sdk.Models;
|
|
using Speckle.Sdk.Tests.Unit.Host;
|
|
|
|
namespace Speckle.Sdk.Tests.Unit.Serialisation;
|
|
|
|
[Collection(nameof(RequiresTypeLoaderCollection))]
|
|
public class SimpleRoundTripTests
|
|
{
|
|
private readonly IOperations _operations;
|
|
|
|
public SimpleRoundTripTests()
|
|
{
|
|
TypeLoader.ReInitialize(typeof(DiningTable).Assembly);
|
|
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());
|
|
}
|
|
}
|