ccb4f54550
* Sdk * Objects * Supressed IDE warnings via editor config instead of nowarn * Nullability and other warnings * using * Required keyword on lines and meshes * Fixed test project * fixed tests * Proxies * Fixed equality of Point * IEquatable * Fixed issue with serialization of detached lists * Added tests for jsonIgnore affecting id calc * removed comments * Fixed issue with fallback to double on large values * Fixed undocumented large number support
45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using NUnit.Framework;
|
|
using Shouldly;
|
|
using Speckle.Objects.Geometry;
|
|
using Speckle.Objects.Geometry.Autocad;
|
|
using Speckle.Objects.Structural.GSA.Geometry;
|
|
using Speckle.Sdk.Host;
|
|
using Speckle.Sdk.Models;
|
|
|
|
namespace Speckle.Objects.Tests.Unit;
|
|
|
|
public class ObjectBaseValidityTests
|
|
{
|
|
[Test]
|
|
public void TestThatTypeWithoutAttributeFails()
|
|
{
|
|
TypeLoader.Reset();
|
|
TypeLoader.Initialize(typeof(Base).Assembly, typeof(GSAAssembly).Assembly);
|
|
}
|
|
|
|
[Test]
|
|
public void InheritanceTest_Disallow()
|
|
{
|
|
var exception = Assert.Throws<InvalidOperationException>(() =>
|
|
{
|
|
TypeLoader.Reset();
|
|
TypeLoader.Initialize(typeof(Base).Assembly, typeof(GSAAssembly).Assembly, typeof(Test).Assembly);
|
|
});
|
|
exception.ShouldNotBeNull();
|
|
exception.Message.ShouldBe(
|
|
"Speckle.Objects.Tests.Unit.ObjectBaseValidityTests+Test inherits from Base has no SpeckleTypeAttribute"
|
|
);
|
|
}
|
|
|
|
[Test]
|
|
public void InheritanceTest_Allow()
|
|
{
|
|
TypeLoader.Reset();
|
|
TypeLoader.Initialize(typeof(Base).Assembly, typeof(GSAAssembly).Assembly);
|
|
var fullTypeString = TypeLoader.GetFullTypeString(typeof(AutocadPolycurve));
|
|
fullTypeString.ShouldBe("Objects.Geometry.Polycurve:Objects.Geometry.Autocad.AutocadPolycurve");
|
|
}
|
|
|
|
public class Test : Polycurve;
|
|
}
|