Files
speckle-sharp-sdk/tests/Speckle.Sdk.Tests.Unit/Serialisation/ObjectModelDeprecationTests.cs
T
Adam Hathcock 4c3e572bfe clean up from progress (#78)
* progress intermediate commit

* add progress for download

* remove unused code

* remove batch sent callbacks

* multi-threaded deserialize works

* Progress for download and deserialization

* Fix tests

* Have less indeterminate deserialization

* fix deserialization

* make download faster with buffered stream

* put local receive back

* remove unused callback

* fmt

* Progress for serialization and upload

* fix uploading

* clean up from progress

* merge fixes and fmt
2024-08-22 11:18:16 +01:00

49 lines
1.3 KiB
C#

using NUnit.Framework;
using Shouldly;
using Speckle.Sdk.Host;
using Speckle.Sdk.Models;
using Speckle.Sdk.Serialisation.Deprecated;
namespace Speckle.Sdk.Tests.Unit.Serialisation
{
[TestFixture]
[TestOf(typeof(TypeLoader))]
public class TypeLoaderTests
{
[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 { }
}