14d959834f
* xunit unit tests * most pass with formatting * convert objects to xunit * remove nunit * format * merge fixes * switch objects to fluent assertions * update to fluent assertions * more FA * convert all to FA * Format * Fix tests * formatting * hopefully made credential test better * Catch more specific exception * use another more specific exception * Fix tests * update to xunit * update packages
48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
using System.Reflection;
|
|
using FluentAssertions;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Speckle.Sdk.Api;
|
|
using Speckle.Sdk.Host;
|
|
using Speckle.Sdk.Models;
|
|
using Speckle.Sdk.Tests.Unit.Host;
|
|
using Xunit;
|
|
|
|
namespace Speckle.Sdk.Tests.Unit.Serialisation;
|
|
|
|
public class SimpleRoundTripTests
|
|
{
|
|
private readonly IOperations _operations;
|
|
|
|
public SimpleRoundTripTests()
|
|
{
|
|
TypeLoader.Reset();
|
|
TypeLoader.Initialize(typeof(Base).Assembly, Assembly.GetExecutingAssembly());
|
|
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());
|
|
}
|
|
}
|