From b80346f3b40a628212d641db76869d2538711b53 Mon Sep 17 00:00:00 2001 From: Blake Farrugia Date: Fri, 5 Jun 2026 22:28:13 -0400 Subject: [PATCH] Update library structure to split off Testing utilities from the Utility area --- Assets/Scripts/Tests/BracerLib.Tests.asmdef | 7 ++++--- .../Tests/Objects/ObjectLifetimeTests.cs | 1 + .../Scripts/Tests/Objects/ObjectMockTests.cs | 1 + .../Scripts/Tests/Properties/PropertyTests.cs | 1 + Assets/Scripts/Tests/Scenes/SceneTests.cs | 1 + .../Scripts/Tests/Utility/MathUtilityTests.cs | 2 +- .../Scripts/Tests/Utility/TriangulatorTest.cs | 1 + Assets/Scripts/Utility/Testing.meta | 8 ++++++++ .../Testing/BracerLib.Utility.Testing.asmdef | 19 +++++++++++++++++++ .../BracerLib.Utility.Testing.asmdef.meta | 7 +++++++ .../Testing}/MonoBehaviourTester.cs | 2 +- .../Testing}/MonoBehaviourTester.cs.meta | 0 .../{Tests => Utility/Testing}/TestBase.cs | 10 +++++----- .../Testing}/TestBase.cs.meta | 0 BracerLib.sln | 8 ++++++++ 15 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 Assets/Scripts/Utility/Testing.meta create mode 100644 Assets/Scripts/Utility/Testing/BracerLib.Utility.Testing.asmdef create mode 100644 Assets/Scripts/Utility/Testing/BracerLib.Utility.Testing.asmdef.meta rename Assets/Scripts/{Tests => Utility/Testing}/MonoBehaviourTester.cs (87%) rename Assets/Scripts/{Tests => Utility/Testing}/MonoBehaviourTester.cs.meta (100%) rename Assets/Scripts/{Tests => Utility/Testing}/TestBase.cs (96%) rename Assets/Scripts/{Tests => Utility/Testing}/TestBase.cs.meta (100%) diff --git a/Assets/Scripts/Tests/BracerLib.Tests.asmdef b/Assets/Scripts/Tests/BracerLib.Tests.asmdef index 43d30b9..8ec4d3a 100644 --- a/Assets/Scripts/Tests/BracerLib.Tests.asmdef +++ b/Assets/Scripts/Tests/BracerLib.Tests.asmdef @@ -3,15 +3,16 @@ "rootNamespace": "BracerLib.Tests", "references": [ "UnityEngine.TestRunner", - "BracerLib" + "BracerLib", + "BracerLib.Utility.Testing" ], "includePlatforms": [], "excludePlatforms": [], "allowUnsafeCode": false, "overrideReferences": true, "precompiledReferences": [ - "nunit.framework.dll", - "Moq.dll" + "Moq.dll", + "nunit.framework.dll" ], "autoReferenced": true, "defineConstraints": [ diff --git a/Assets/Scripts/Tests/Objects/ObjectLifetimeTests.cs b/Assets/Scripts/Tests/Objects/ObjectLifetimeTests.cs index 8c29a37..09931d1 100644 --- a/Assets/Scripts/Tests/Objects/ObjectLifetimeTests.cs +++ b/Assets/Scripts/Tests/Objects/ObjectLifetimeTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections; +using BracerLib.Utility.Testing; using NUnit.Framework; using UnityEngine; using UnityEngine.TestTools; diff --git a/Assets/Scripts/Tests/Objects/ObjectMockTests.cs b/Assets/Scripts/Tests/Objects/ObjectMockTests.cs index e68f9d7..0df4e3f 100644 --- a/Assets/Scripts/Tests/Objects/ObjectMockTests.cs +++ b/Assets/Scripts/Tests/Objects/ObjectMockTests.cs @@ -1,4 +1,5 @@ using System.Collections; +using BracerLib.Utility.Testing; using Moq; using NUnit.Framework; using UnityEngine; diff --git a/Assets/Scripts/Tests/Properties/PropertyTests.cs b/Assets/Scripts/Tests/Properties/PropertyTests.cs index 177f63c..b83f220 100644 --- a/Assets/Scripts/Tests/Properties/PropertyTests.cs +++ b/Assets/Scripts/Tests/Properties/PropertyTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections; +using BracerLib.Utility.Testing; using UnityEngine; using UnityEngine.Assertions; using UnityEngine.TestTools; diff --git a/Assets/Scripts/Tests/Scenes/SceneTests.cs b/Assets/Scripts/Tests/Scenes/SceneTests.cs index 851f73f..4059988 100644 --- a/Assets/Scripts/Tests/Scenes/SceneTests.cs +++ b/Assets/Scripts/Tests/Scenes/SceneTests.cs @@ -1,4 +1,5 @@ using System.Collections; +using BracerLib.Utility.Testing; using UnityEngine.Assertions; using UnityEngine.SceneManagement; using UnityEngine.TestTools; diff --git a/Assets/Scripts/Tests/Utility/MathUtilityTests.cs b/Assets/Scripts/Tests/Utility/MathUtilityTests.cs index fd7c647..28e48c6 100644 --- a/Assets/Scripts/Tests/Utility/MathUtilityTests.cs +++ b/Assets/Scripts/Tests/Utility/MathUtilityTests.cs @@ -1,7 +1,7 @@ using System.Collections; using BracerLib.Utility; +using BracerLib.Utility.Testing; using NUnit.Framework; -using UnityEngine; namespace BracerLib.Tests.Utility { diff --git a/Assets/Scripts/Tests/Utility/TriangulatorTest.cs b/Assets/Scripts/Tests/Utility/TriangulatorTest.cs index 2088ee3..9634876 100644 --- a/Assets/Scripts/Tests/Utility/TriangulatorTest.cs +++ b/Assets/Scripts/Tests/Utility/TriangulatorTest.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using BracerLib.Utility; +using BracerLib.Utility.Testing; using NUnit.Framework; using UnityEngine; diff --git a/Assets/Scripts/Utility/Testing.meta b/Assets/Scripts/Utility/Testing.meta new file mode 100644 index 0000000..9daf862 --- /dev/null +++ b/Assets/Scripts/Utility/Testing.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c46ea07e02074d340aa2434ad26fcc12 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Utility/Testing/BracerLib.Utility.Testing.asmdef b/Assets/Scripts/Utility/Testing/BracerLib.Utility.Testing.asmdef new file mode 100644 index 0000000..98f238b --- /dev/null +++ b/Assets/Scripts/Utility/Testing/BracerLib.Utility.Testing.asmdef @@ -0,0 +1,19 @@ +{ + "name": "BracerLib.Utility.Testing", + "rootNamespace": "BracerLib.Utility.Testing", + "references": [ + "GUID:27619889b8ba8c24980f49ee34dbb44a" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "Moq.dll", + "nunit.framework.dll" + ], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/Scripts/Utility/Testing/BracerLib.Utility.Testing.asmdef.meta b/Assets/Scripts/Utility/Testing/BracerLib.Utility.Testing.asmdef.meta new file mode 100644 index 0000000..98e4d92 --- /dev/null +++ b/Assets/Scripts/Utility/Testing/BracerLib.Utility.Testing.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f1e562b6a035c2b4d9c0bd9fb0d2e18f +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Tests/MonoBehaviourTester.cs b/Assets/Scripts/Utility/Testing/MonoBehaviourTester.cs similarity index 87% rename from Assets/Scripts/Tests/MonoBehaviourTester.cs rename to Assets/Scripts/Utility/Testing/MonoBehaviourTester.cs index 4f0c38a..9b31075 100644 --- a/Assets/Scripts/Tests/MonoBehaviourTester.cs +++ b/Assets/Scripts/Utility/Testing/MonoBehaviourTester.cs @@ -1,7 +1,7 @@ using UnityEngine; using UnityEngine.TestTools; -namespace BracerLib.Tests +namespace BracerLib.Utility.Testing { [ExecuteInEditMode] [ExcludeFromCoverage] diff --git a/Assets/Scripts/Tests/MonoBehaviourTester.cs.meta b/Assets/Scripts/Utility/Testing/MonoBehaviourTester.cs.meta similarity index 100% rename from Assets/Scripts/Tests/MonoBehaviourTester.cs.meta rename to Assets/Scripts/Utility/Testing/MonoBehaviourTester.cs.meta diff --git a/Assets/Scripts/Tests/TestBase.cs b/Assets/Scripts/Utility/Testing/TestBase.cs similarity index 96% rename from Assets/Scripts/Tests/TestBase.cs rename to Assets/Scripts/Utility/Testing/TestBase.cs index f524c50..f821665 100644 --- a/Assets/Scripts/Tests/TestBase.cs +++ b/Assets/Scripts/Utility/Testing/TestBase.cs @@ -12,7 +12,7 @@ using UnityEngine.SceneManagement; using UnityEngine.TestTools; using Object = UnityEngine.Object; -namespace BracerLib.Tests +namespace BracerLib.Utility.Testing { [ExcludeFromCodeCoverage, ExcludeFromCoverage] public class TestBase @@ -273,12 +273,12 @@ namespace BracerLib.Tests /// var obj = new SomeObject(); /// SetReflectedValue(obj, "item", 25); /// - private protected void SetReflectedValue(object targetObject, string targetProperty, object targetValue) + protected internal void SetReflectedValue(object targetObject, string targetProperty, object targetValue) { SetReflectedValue(targetObject, targetObject.GetType(), targetProperty, targetValue); } - private protected void SetReflectedValues(object targetObject, params ValueTuple[] properties) + protected internal void SetReflectedValues(object targetObject, params ValueTuple[] properties) { var type = targetObject.GetType(); @@ -303,7 +303,7 @@ namespace BracerLib.Tests /// /// SetObjectReference(c, "item", someOtherObj); /// - private protected void SetObjectReference(Object targetObj, string targetValue, Object value) + protected internal void SetObjectReference(Object targetObj, string targetValue, Object value) { if (!objectPropertyCache.TryGetValue(targetObj, out var serializedObject)) { @@ -332,7 +332,7 @@ namespace BracerLib.Tests /// /// SetObjectReference(c, a); /// - private protected void SetObjectReferences(Object targetObj, params ValueTuple[] properties) + protected internal void SetObjectReferences(Object targetObj, params ValueTuple[] properties) { for (var i = 0; i < properties.Length; i++) SetObjectReference(targetObj, properties[i].Item1, properties[i].Item2); diff --git a/Assets/Scripts/Tests/TestBase.cs.meta b/Assets/Scripts/Utility/Testing/TestBase.cs.meta similarity index 100% rename from Assets/Scripts/Tests/TestBase.cs.meta rename to Assets/Scripts/Utility/Testing/TestBase.cs.meta diff --git a/BracerLib.sln b/BracerLib.sln index 13b1471..145ddba 100644 --- a/BracerLib.sln +++ b/BracerLib.sln @@ -143,6 +143,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.VisualScripting.DocCo EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.PlasticSCM.Editor.Entities", "Unity.PlasticSCM.Editor.Entities.csproj", "{433b063d-fdcf-942c-cacc-e0a12ecfab4c}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BracerLib.Utility.Testing", "BracerLib.Utility.Testing.csproj", "{b503e9f1-fd6c-d2cf-1011-4ba7062b5641}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Rendering.LightTransport.Editor", "Unity.Rendering.LightTransport.Editor.csproj", "{d0c562bc-37b2-968f-c487-6f9c7907dfc9}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Collections.Editor", "Unity.Collections.Editor.csproj", "{7a399762-1357-59af-18c5-64fb51c178f2}" @@ -213,6 +215,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.InternalAPIEngineBrid EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.VisualScripting.DocCodeExamples", "Unity.VisualScripting.DocCodeExamples.Player.csproj", "{fdbabadb-0f6b-49cd-e87a-0ebbaf4d2d96}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BracerLib.Utility.Testing", "BracerLib.Utility.Testing.Player.csproj", "{151136ac-e31c-c81e-984b-669ed3714bc0}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.RenderPipelines.Universal.Config.Runtime", "Unity.RenderPipelines.Universal.Config.Runtime.Player.csproj", "{87b810fe-daa0-9aec-85dd-88cba86d95a4}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary", "Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary.Player.csproj", "{d4a0c4a1-1452-37dd-3d3d-772525ed81eb}" @@ -430,6 +434,8 @@ Global {3acddcbe-f2e3-f9b3-384f-b00f037631c9}.Debug|Any CPU.Build.0 = Debug|Any CPU {433b063d-fdcf-942c-cacc-e0a12ecfab4c}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {433b063d-fdcf-942c-cacc-e0a12ecfab4c}.Debug|Any CPU.Build.0 = Debug|Any CPU + {b503e9f1-fd6c-d2cf-1011-4ba7062b5641}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {b503e9f1-fd6c-d2cf-1011-4ba7062b5641}.Debug|Any CPU.Build.0 = Debug|Any CPU {d0c562bc-37b2-968f-c487-6f9c7907dfc9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {d0c562bc-37b2-968f-c487-6f9c7907dfc9}.Debug|Any CPU.Build.0 = Debug|Any CPU {7a399762-1357-59af-18c5-64fb51c178f2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -500,6 +506,8 @@ Global {9af20a01-0715-5d01-32ca-c4bb2fd0bb7f}.Debug|Any CPU.Build.0 = Debug|Any CPU {fdbabadb-0f6b-49cd-e87a-0ebbaf4d2d96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {fdbabadb-0f6b-49cd-e87a-0ebbaf4d2d96}.Debug|Any CPU.Build.0 = Debug|Any CPU + {151136ac-e31c-c81e-984b-669ed3714bc0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {151136ac-e31c-c81e-984b-669ed3714bc0}.Debug|Any CPU.Build.0 = Debug|Any CPU {87b810fe-daa0-9aec-85dd-88cba86d95a4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {87b810fe-daa0-9aec-85dd-88cba86d95a4}.Debug|Any CPU.Build.0 = Debug|Any CPU {d4a0c4a1-1452-37dd-3d3d-772525ed81eb}.Debug|Any CPU.ActiveCfg = Debug|Any CPU