This commit is contained in:
watrabi
2025-09-18 17:55:52 -04:00
commit 977f1ff4b8
15030 changed files with 17324420 additions and 0 deletions
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Roblox.Test
{
public interface IRemoteTestShim
{
bool DoesTestExist(string AssemblyName, string MethodName);
void RunTest(string AssemblyName, string MethodName, string DeploymentDir, TextWriter tw);
string GetTestHeader(string AssemblyName, string MethodName);
}
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class HeaderStringAttribute : Attribute
{
private string header;
public HeaderStringAttribute(string header) { this.header = header; }
public string Header { get { return header; } }
}
}
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("BaseInterface")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BaseInterface")]
[assembly: AssemblyCopyright("Copyright © 2008")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a15d7e3a-8774-4243-aca3-5813ec6779e7")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,187 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.IO;
namespace Roblox.Test
{
[Serializable]
class RemoteTestShimImpl : MarshalByRefObject, IRemoteTestShim
{
private class MyTestContext : TestContext
{
Dictionary<string, object> properties = new Dictionary<string, object>();
TextWriter textwriter;
public MyTestContext(string TestDeploymentDir, TextWriter tw)
{
textwriter = tw;
properties["TestDeploymentDir"] = TestDeploymentDir;
}
public override void AddResultFile(string fileName)
{
throw new NotImplementedException();
}
public override void BeginTimer(string timerName)
{
throw new NotImplementedException();
}
public override System.Data.Common.DbConnection DataConnection
{
get { throw new NotImplementedException(); }
}
public override System.Data.DataRow DataRow
{
get { throw new NotImplementedException(); }
}
public override void EndTimer(string timerName)
{
throw new NotImplementedException();
}
public override System.Collections.IDictionary Properties
{
get { return properties; }
}
public override void WriteLine(string format, params object[] args)
{
textwriter.WriteLine(format, args);
}
}
public void RunTest(string AssemblyName, string MethodName, string DeploymentDir, TextWriter tw)
{
Type ClassType = null;
MemberInfo memberCleanup = null;
MemberInfo memberInitialize = null;
MemberInfo memberTestMethod = null;
Assembly ass = Assembly.Load(AssemblyName);
foreach (Type type in ass.GetTypes())
{
object[] obj = type.GetCustomAttributes(typeof(TestClassAttribute), false);
if (obj.Length > 0)
{
ClassType = type;
memberCleanup = null;
memberInitialize = null;
memberTestMethod = null;
foreach (MemberInfo memberinfo in ClassType.GetMembers())
{
obj = memberinfo.GetCustomAttributes(typeof(TestMethodAttribute), false);
if (obj.Length > 0 && memberinfo.Name == MethodName)
{
memberTestMethod = memberinfo;
continue;
}
obj = memberinfo.GetCustomAttributes(typeof(TestCleanupAttribute), false);
if (obj.Length > 0)
{
memberCleanup = memberinfo;
continue;
}
obj = memberinfo.GetCustomAttributes(typeof(TestInitializeAttribute), false);
if (obj.Length > 0)
{
memberInitialize = memberinfo;
continue;
}
}
if (memberTestMethod != null)
{
// found it!
break;
}
}
}
if (memberTestMethod != null)
{
object instance = ass.CreateInstance(ClassType.FullName);
if (instance != null)
{
//setup TestContext
PropertyInfo propertyinfo = ClassType.GetProperty("TestContext");
if (propertyinfo != null)
{
propertyinfo.SetValue(instance, new MyTestContext(DeploymentDir, tw), null);
}
}
if (memberInitialize != null)
{
ClassType.InvokeMember(memberInitialize.Name, BindingFlags.InvokeMethod, null, instance, new object[] { });
}
try
{
ClassType.InvokeMember(memberTestMethod.Name, BindingFlags.InvokeMethod, null, instance, new object[] { });
}
finally
{
if (memberCleanup != null)
{
ClassType.InvokeMember(memberCleanup.Name, BindingFlags.InvokeMethod, null, instance, new object[] { });
}
}
}
else
{
throw new Exception(String.Format("Test method {0} not found!", MethodName));
}
}
public bool DoesTestExist(string AssemblyName, string MethodName)
{
throw new NotImplementedException();
}
public string GetTestHeader(string AssemblyName, string MethodName)
{
Type ClassType = null;
Assembly ass = Assembly.Load(AssemblyName);
foreach (Type type in ass.GetTypes())
{
object[] obj = type.GetCustomAttributes(typeof(TestClassAttribute), false);
if (obj.Length > 0)
{
ClassType = type;
foreach (MemberInfo memberinfo in ClassType.GetMembers())
{
obj = memberinfo.GetCustomAttributes(typeof(HeaderStringAttribute), false);
if (obj.Length > 0 && memberinfo.Name == MethodName)
{
HeaderStringAttribute attrib = (HeaderStringAttribute)(obj[0]);
return attrib.Header;
}
}
}
}
// no header. No biggie.
return "";
}
}
}
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{3D66508E-ADA5-4C7B-BD79-53B20B6D4DAB}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Roblox.Test</RootNamespace>
<AssemblyName>Roblox.Test.RemoteTestShim</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="IRemoteTestShim.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RemoteTestShimImpl.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>