8a148b892f
* removes unused classes and gh schema constructors * additional cleanup of backwards compatibility (v2) * Update Arc.cs * updates unit tests * re-adds bbox to box * updates tests * pr fixes for backwards compatibility * Uses a new objects test in Revit for serialization tests * format * updates revit model curve class to inherit from curve geometry, and adds deprecated v2 classes * fixes transform unit tests * fixes deprecated speckle type * removes unnecessary new revit curve classes --------- Co-authored-by: Adam Hathcock <adam@hathcock.uk> Co-authored-by: Alan Rynne <alan@rynne.es>
45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
using NUnit.Framework;
|
|
using Shouldly;
|
|
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
|
|
{
|
|
[Test]
|
|
public void TestThatTypeWithoutAttributeFails()
|
|
{
|
|
TypeLoader.Reset();
|
|
TypeLoader.Initialize(typeof(Base).Assembly, typeof(Point).Assembly);
|
|
}
|
|
|
|
[Test]
|
|
public void InheritanceTest_Disallow()
|
|
{
|
|
var exception = Assert.Throws<InvalidOperationException>(() =>
|
|
{
|
|
TypeLoader.Reset();
|
|
TypeLoader.Initialize(typeof(Base).Assembly, typeof(Point).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(Point).Assembly);
|
|
var fullTypeString = TypeLoader.GetFullTypeString(typeof(AutocadPolycurve));
|
|
fullTypeString.ShouldBe("Objects.Geometry.Polycurve:Objects.Geometry.Autocad.AutocadPolycurve");
|
|
}
|
|
|
|
public class Test : Polycurve;
|
|
}
|