Resolve all high-severity architecture review findings

This commit is contained in:
Joseph Doherty
2026-09-09 16:13:58 -04:00
parent 8bfe65512e
commit 146a13238f
192 changed files with 3160 additions and 753 deletions
@@ -11,6 +11,25 @@ namespace ZB.MOM.WW.ScadaBridge.ScriptAnalysis.Tests;
/// </summary>
public class ScriptTrustValidatorTests
{
[Theory]
[InlineData("object o = new object(); System.Runtime.CompilerServices.Unsafe.As<object, string>(ref o);")]
[InlineData("System.Runtime.CompilerServices.RuntimeHelpers.GetUninitializedObject(typeof(object));")]
[InlineData("new System.Runtime.Loader.AssemblyLoadContext(\"probe\");")]
[InlineData("using U = System.Runtime.CompilerServices.Unsafe; object o = new object(); U.As<object, string>(ref o);")]
[InlineData("using static System.Runtime.CompilerServices.RuntimeHelpers; GetUninitializedObject(typeof(object));")]
public void MG1_RejectsRuntimeEscapeApis(string code)
{
Assert.NotEmpty(ScriptTrustValidator.FindViolations(code));
}
[Theory]
[InlineData("await System.Threading.Tasks.Task.Delay(1);")]
[InlineData("string Name([System.Runtime.CompilerServices.CallerMemberName] string name = \"\") => name;")]
public void MG1_AllowsCompilerSupport(string code)
{
Assert.Empty(ScriptTrustValidator.FindViolations(code));
}
// ---- Reject (non-empty violations) --------------------------------------
[Fact]