using System; using NUnit.Framework; using Robust.Shared.IoC; using Robust.Shared.Reflection; using Robust.Shared.Serialization; namespace Robust.UnitTesting.Shared.Serialization { [TestFixture] internal sealed class NetSerializableAttribute_Test : OurRobustUnitTest { private IReflectionManager _reflection = default!; [OneTimeSetUp] public void TestFixtureSetup() { _reflection = IoCManager.Resolve(); } [Test] public void AllNetSerializableObjectsHaveSerializableAttribute() { var types = _reflection.FindTypesWithAttribute(); foreach (var type in types) { Assert.That(Attribute.IsDefined(type, typeof(NetSerializableAttribute), true), $"{type.FullName} has {nameof(NetSerializableAttribute)}, but not the required {nameof(SerializableAttribute)}."); } } } }