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
44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using FluentAssertions;
|
|
using Speckle.Objects.Geometry;
|
|
using Speckle.Objects.Geometry.Autocad;
|
|
using Speckle.Sdk.Host;
|
|
using Speckle.Sdk.Models;
|
|
using Point = Speckle.Objects.Geometry.Point;
|
|
|
|
namespace Speckle.Objects.Tests.Unit;
|
|
|
|
public class ObjectBaseValidityTests
|
|
{
|
|
[Fact]
|
|
public void TestThatTypeWithoutAttributeFails()
|
|
{
|
|
TypeLoader.Reset();
|
|
TypeLoader.Initialize(typeof(Base).Assembly, typeof(Point).Assembly);
|
|
}
|
|
|
|
[Fact]
|
|
public void InheritanceTest_Disallow()
|
|
{
|
|
var exception = Assert.Throws<InvalidOperationException>(() =>
|
|
{
|
|
TypeLoader.Reset();
|
|
TypeLoader.Initialize(typeof(Base).Assembly, typeof(Point).Assembly, typeof(Test).Assembly);
|
|
});
|
|
exception.Should().NotBeNull();
|
|
exception
|
|
.Message.Should()
|
|
.Be("Speckle.Objects.Tests.Unit.ObjectBaseValidityTests+Test inherits from Base has no SpeckleTypeAttribute");
|
|
}
|
|
|
|
[Fact]
|
|
public void InheritanceTest_Allow()
|
|
{
|
|
TypeLoader.Reset();
|
|
TypeLoader.Initialize(typeof(Base).Assembly, typeof(Point).Assembly);
|
|
var fullTypeString = TypeLoader.GetFullTypeString(typeof(AutocadPolycurve));
|
|
fullTypeString.Should().Be("Objects.Geometry.Polycurve:Objects.Geometry.Autocad.AutocadPolycurve");
|
|
}
|
|
|
|
public class Test : Polycurve;
|
|
}
|