Initial Commit
This commit is contained in:
parent
53eb92e9af
commit
270ab7d11f
15341 changed files with 700234 additions and 0 deletions
|
@ -0,0 +1,12 @@
|
|||
using System.Reflection;
|
||||
|
||||
namespace UnityEngine.TestTools.Utils
|
||||
{
|
||||
internal class AssemblyLoadProxy : IAssemblyLoadProxy
|
||||
{
|
||||
public IAssemblyWrapper Load(string assemblyString)
|
||||
{
|
||||
return new AssemblyWrapper(Assembly.Load(assemblyString));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fb593906b7b6d824087dcaebf6c082e0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace UnityEngine.TestTools.Utils
|
||||
{
|
||||
internal class AssemblyWrapper : IAssemblyWrapper
|
||||
{
|
||||
public AssemblyWrapper(Assembly assembly)
|
||||
{
|
||||
Assembly = assembly;
|
||||
Name = assembly.GetName();
|
||||
}
|
||||
|
||||
public Assembly Assembly { get; }
|
||||
|
||||
public AssemblyName Name { get; }
|
||||
|
||||
public virtual string Location
|
||||
{
|
||||
get
|
||||
{
|
||||
//Some platforms dont support this
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual AssemblyName[] GetReferencedAssemblies()
|
||||
{
|
||||
//Some platforms dont support this
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2e3b9bbf2c1a3cd4f88883ca32882ec6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,7 @@
|
|||
namespace UnityEngine.TestTools.Utils
|
||||
{
|
||||
internal interface IAssemblyLoadProxy
|
||||
{
|
||||
IAssemblyWrapper Load(string assemblyString);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 12dfd4bdbb5c8e6419432fbc54ef25d9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,12 @@
|
|||
using System.Reflection;
|
||||
|
||||
namespace UnityEngine.TestTools.Utils
|
||||
{
|
||||
internal interface IAssemblyWrapper
|
||||
{
|
||||
Assembly Assembly { get; }
|
||||
AssemblyName Name { get; }
|
||||
string Location { get; }
|
||||
AssemblyName[] GetReferencedAssemblies();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1c5afe945b715e149a70113a4be7b32a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,7 @@
|
|||
namespace UnityEngine.TestTools.Utils
|
||||
{
|
||||
internal interface IScriptingRuntimeProxy
|
||||
{
|
||||
string[] GetAllUserAssemblies();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fe4aef60e4ace544c8430da8ef8acba2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,10 @@
|
|||
using NUnit.Framework.Interfaces;
|
||||
|
||||
namespace UnityEngine.TestTools.Utils
|
||||
{
|
||||
internal interface ITestAssemblyProvider
|
||||
{
|
||||
ITest GetTestsWithNUnit();
|
||||
IAssemblyWrapper[] GetUserAssemblies();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c5acba6181d845c4e92146009bd4480f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,66 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NUnit.Framework.Interfaces;
|
||||
using UnityEngine.TestTools.NUnitExtensions;
|
||||
|
||||
namespace UnityEngine.TestTools.Utils
|
||||
{
|
||||
internal class PlayerTestAssemblyProvider
|
||||
{
|
||||
private IAssemblyLoadProxy m_AssemblyLoadProxy;
|
||||
private readonly List<string> m_AssembliesToLoad;
|
||||
|
||||
//Cached until domain reload
|
||||
private static List<IAssemblyWrapper> m_LoadedAssemblies;
|
||||
|
||||
internal PlayerTestAssemblyProvider(IAssemblyLoadProxy assemblyLoadProxy, List<string> assembliesToLoad)
|
||||
{
|
||||
m_AssemblyLoadProxy = assemblyLoadProxy;
|
||||
m_AssembliesToLoad = assembliesToLoad;
|
||||
LoadAssemblies();
|
||||
}
|
||||
|
||||
public ITest GetTestsWithNUnit()
|
||||
{
|
||||
return BuildTests(TestPlatform.PlayMode, m_LoadedAssemblies.ToArray());
|
||||
}
|
||||
|
||||
public List<IAssemblyWrapper> GetUserAssemblies()
|
||||
{
|
||||
return m_LoadedAssemblies;
|
||||
}
|
||||
|
||||
protected static ITest BuildTests(TestPlatform testPlatform, IAssemblyWrapper[] assemblies)
|
||||
{
|
||||
var settings = UnityTestAssemblyBuilder.GetNUnitTestBuilderSettings(testPlatform);
|
||||
var builder = new UnityTestAssemblyBuilder();
|
||||
return builder.Build(assemblies.Select(a => a.Assembly).ToArray(), Enumerable.Repeat(testPlatform, assemblies.Length).ToArray(), settings);
|
||||
}
|
||||
|
||||
private void LoadAssemblies()
|
||||
{
|
||||
if (m_LoadedAssemblies != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_LoadedAssemblies = new List<IAssemblyWrapper>();
|
||||
|
||||
foreach (var userAssembly in m_AssembliesToLoad)
|
||||
{
|
||||
IAssemblyWrapper a;
|
||||
try
|
||||
{
|
||||
a = m_AssemblyLoadProxy.Load(userAssembly);
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (a != null)
|
||||
m_LoadedAssemblies.Add(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 43a3aec217baa9644a7cf34b5f93fed9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,10 @@
|
|||
namespace UnityEngine.TestTools.Utils
|
||||
{
|
||||
internal class ScriptingRuntimeProxy : IScriptingRuntimeProxy
|
||||
{
|
||||
public string[] GetAllUserAssemblies()
|
||||
{
|
||||
return ScriptingRuntime.GetAllUserAssemblies();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f3a361a6ad1aff14ba8f48976e94ad76
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue