Merge branch '20-11-19-sandboxing' into 20-11-27-merge
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Content.Client;
|
||||
using Content.Server;
|
||||
using Robust.UnitTesting;
|
||||
@@ -19,5 +21,26 @@ namespace Content.Tests
|
||||
ClientContentIoC.Register();
|
||||
}
|
||||
}
|
||||
|
||||
protected override Assembly[] GetContentAssemblies()
|
||||
{
|
||||
var l = new List<Assembly>
|
||||
{
|
||||
typeof(Content.Shared.EntryPoint).Assembly
|
||||
};
|
||||
|
||||
if (Project == UnitTestProject.Server)
|
||||
{
|
||||
l.Add(typeof(Content.Server.EntryPoint).Assembly);
|
||||
}
|
||||
else if (Project == UnitTestProject.Client)
|
||||
{
|
||||
l.Add(typeof(Content.Client.EntryPoint).Assembly);
|
||||
}
|
||||
|
||||
l.Add(typeof(ContentUnitTest).Assembly);
|
||||
|
||||
return l.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ namespace Content.Tests.Server.GameObjects.Components.Mobs
|
||||
// in a unit test
|
||||
|
||||
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
|
||||
prototypeManager.RegisterType(typeof(AlertPrototype));
|
||||
var factory = IoCManager.Resolve<IComponentFactory>();
|
||||
factory.Register<ServerAlertsComponent>();
|
||||
prototypeManager.LoadFromStream(new StringReader(PROTOTYPES));
|
||||
|
||||
@@ -12,7 +12,7 @@ using YamlDotNet.RepresentationModel;
|
||||
namespace Content.Tests.Shared.Alert
|
||||
{
|
||||
[TestFixture, TestOf(typeof(AlertManager))]
|
||||
public class AlertManagerTests : RobustUnitTest
|
||||
public class AlertManagerTests : ContentUnitTest
|
||||
{
|
||||
const string PROTOTYPES = @"
|
||||
- type: alert
|
||||
@@ -28,9 +28,7 @@ namespace Content.Tests.Shared.Alert
|
||||
public void TestAlertManager()
|
||||
{
|
||||
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
|
||||
prototypeManager.RegisterType(typeof(AlertPrototype));
|
||||
prototypeManager.LoadFromStream(new StringReader(PROTOTYPES));
|
||||
IoCManager.RegisterInstance<AlertManager>(new AlertManager());
|
||||
var alertManager = IoCManager.Resolve<AlertManager>();
|
||||
alertManager.Initialize();
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ using Robust.UnitTesting;
|
||||
namespace Content.Tests.Shared.Alert
|
||||
{
|
||||
[TestFixture, TestOf(typeof(AlertOrderPrototype))]
|
||||
public class AlertOrderPrototypeTests : RobustUnitTest
|
||||
public class AlertOrderPrototypeTests : ContentUnitTest
|
||||
{
|
||||
const string PROTOTYPES = @"
|
||||
- type: alertOrder
|
||||
@@ -64,8 +64,6 @@ namespace Content.Tests.Shared.Alert
|
||||
public void TestAlertOrderPrototype()
|
||||
{
|
||||
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
|
||||
prototypeManager.RegisterType(typeof(AlertPrototype));
|
||||
prototypeManager.RegisterType(typeof(AlertOrderPrototype));
|
||||
prototypeManager.LoadFromStream(new StringReader(PROTOTYPES));
|
||||
|
||||
var alertOrder = prototypeManager.EnumeratePrototypes<AlertOrderPrototype>().FirstOrDefault();
|
||||
|
||||
@@ -11,7 +11,7 @@ using YamlDotNet.RepresentationModel;
|
||||
namespace Content.Tests.Shared.Alert
|
||||
{
|
||||
[TestFixture, TestOf(typeof(AlertPrototype))]
|
||||
public class AlertPrototypeTests : RobustUnitTest
|
||||
public class AlertPrototypeTests : ContentUnitTest
|
||||
{
|
||||
private const string PROTOTYPE = @"- type: alert
|
||||
alertType: HumanHealth
|
||||
|
||||
Reference in New Issue
Block a user