Files
sbox-public/engine/Sandbox.Test/System/ThirdPartyLegalTest.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

34 lines
1.1 KiB
C#

using System;
using System.IO;
using static Editor.AboutWidget;
namespace TestSystem;
[TestClass]
public class ThirdPartyLegalTest
{
[TestMethod]
public void CheckJsonValidity()
{
File.ReadAllText( "thirdpartylegalnotices/dependency_index.json" );
var fileData = File.ReadAllText( "thirdpartylegalnotices/dependency_index.json" );
var indexData = Json.Deserialize<DependencyIndex>( fileData );
// If we got this far without an exception, the JSON is valid
Assert.IsNotNull( indexData );
}
[TestMethod]
public void CheckAllLicensesExist()
{
var fileData = File.ReadAllText( "thirdpartylegalnotices/dependency_index.json" );
var indexData = Json.Deserialize<DependencyIndex>( fileData );
foreach ( var component in indexData.Components )
{
// We don't require a license for public domain components
if ( component.License.ToLower() == "public-domain" || component.License.ToLower() == "proprietary" ) continue;
var licensePath = Path.Combine( "thirdpartylegalnotices/licenses/", component.Name.ToLower().Replace( " ", "-" ) );
Assert.IsTrue( File.Exists( licensePath ), $"License file missing: {licensePath}" );
}
}
}