6f5f044095
* compiles with relevant deletions * Test fixes * fix type loading * type load for tests * speckle objects renamespace * rename Core to Sdk * Fix test references * tests renaming * rename logging * fmt * start of adding an attribute to all base types * convert all types and do basic test * Fix most tests * fix more tests * fmt * Build fix * add changes and more tests * Fix tests * Fix integration tests
50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
using NUnit.Framework;
|
|
using Shouldly;
|
|
using Speckle.Sdk.Host;
|
|
using Speckle.Sdk.Models;
|
|
using Speckle.Sdk.Serialisation.Deprecated;
|
|
using Speckle.Sdk.Serialisation.SerializationUtilities;
|
|
|
|
namespace Speckle.Sdk.Tests.Unit.Serialisation
|
|
{
|
|
[TestFixture]
|
|
[TestOf(typeof(BaseObjectSerializationUtilities))]
|
|
public class ObjectModelDeprecationTests
|
|
{
|
|
[SetUp]
|
|
public void Setup()
|
|
{
|
|
TypeLoader.Reset();
|
|
TypeLoader.Initialize(typeof(Base).Assembly, typeof(MySpeckleBase).Assembly);
|
|
}
|
|
|
|
[Test]
|
|
public void TestThatTypeWithoutAttributeFails()
|
|
{
|
|
var e = Assert.Throws<InvalidOperationException>(() => TypeLoader.ParseType(typeof(string)));
|
|
e.ShouldNotBeNull();
|
|
}
|
|
|
|
[Test]
|
|
public void TestThatTypeWithoutMultipleAttributes()
|
|
{
|
|
string destinationType = $"Speckle.Core.Serialisation.{nameof(MySpeckleBase)}";
|
|
|
|
var result = TypeLoader.GetAtomicType(destinationType);
|
|
Assert.That(result, Is.EqualTo(typeof(MySpeckleBase)));
|
|
|
|
destinationType = $"Speckle.Core.Serialisation.Deprecated.{nameof(MySpeckleBase)}";
|
|
|
|
result = TypeLoader.GetAtomicType(destinationType);
|
|
Assert.That(result, Is.EqualTo(typeof(MySpeckleBase)));
|
|
}
|
|
}
|
|
}
|
|
|
|
namespace Speckle.Sdk.Serialisation.Deprecated
|
|
{
|
|
[SpeckleType("Speckle.Core.Serialisation.MySpeckleBase")]
|
|
[DeprecatedSpeckleType("Speckle.Core.Serialisation.Deprecated.MySpeckleBase")]
|
|
public class MySpeckleBase : Base { }
|
|
}
|