mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-01 17:47:24 +02:00
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
34 lines
990 B
C#
34 lines
990 B
C#
using System;
|
|
using NUnit.Framework;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Reflection;
|
|
using Robust.Shared.Serialization;
|
|
|
|
namespace Robust.UnitTesting.Shared.Serialization
|
|
{
|
|
[TestFixture]
|
|
sealed class NetSerializableAttribute_Test : RobustUnitTest
|
|
{
|
|
private IReflectionManager _reflection = default!;
|
|
|
|
[OneTimeSetUp]
|
|
public void TestFixtureSetup()
|
|
{
|
|
_reflection = IoCManager.Resolve<IReflectionManager>();
|
|
}
|
|
|
|
[Test]
|
|
public void AllNetSerializableObjectsHaveSerializableAttribute()
|
|
{
|
|
var types = _reflection.FindTypesWithAttribute<NetSerializableAttribute>();
|
|
|
|
foreach (var type in types)
|
|
{
|
|
Assert.IsTrue(Attribute.IsDefined(type, typeof(NetSerializableAttribute), true),
|
|
$"{type.FullName} has {nameof(NetSerializableAttribute)}, but not the required {nameof(SerializableAttribute)}.");
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|