A game about forced loneliness, made by TACStudios
1using System; 2 3namespace UnityEngine.TestTools 4{ 5 /// <summary> 6 /// The presence of this attribute makes the Test Runner expect every single log. By 7 /// default, the runner only fails automatically on any error logs, so this adds warnings and infos as well. 8 /// It is the same as calling `LogAssert.NoUnexpectedReceived()` at the bottom of every affected test. 9 /// 10 /// This attribute can be applied to test assemblies (affects every test in the assembly), fixtures (affects every test in the fixture), or on individual test methods. It is also automatically inherited from base 11 /// fixtures. 12 /// 13 /// The `MustExpect` property (on by default) lets you selectively enable or disable the higher level value. For 14 /// example when migrating an assembly to this more strict checking method, you might attach 15 /// `[assembly:TestMustExpectAllLogs]` to the assembly itself, but whitelist individual failing fixtures and test methods 16 /// by attaching `[TestMustExpectAllLogs(MustExpect=false)]` until they can be migrated. This also means new tests in that 17 /// assembly would be required to have the more strict checking. 18 /// </summary> 19 [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)] 20 public class TestMustExpectAllLogsAttribute : Attribute 21 { 22 /// <summary> 23 /// Initializes and returns an instance of TestMustExpectAllLogsAttribute. 24 /// </summary> 25 /// <param name="mustExpect"> 26 /// A value indicating whether the test must expect all logs. 27 /// </param> 28 public TestMustExpectAllLogsAttribute(bool mustExpect = true) 29 => MustExpect = mustExpect; 30 /// <summary> 31 /// Returns the flag of whether the test must expect all logs. 32 /// </summary> 33 public bool MustExpect { get; } 34 } 35}