Update content unit tests for engine modloader changes.
This commit is contained in:
@@ -13,7 +13,6 @@ using Robust.Shared.Interfaces.Network;
|
|||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.UnitTesting;
|
using Robust.UnitTesting;
|
||||||
using EntryPoint = Content.Client.EntryPoint;
|
|
||||||
|
|
||||||
namespace Content.IntegrationTests
|
namespace Content.IntegrationTests
|
||||||
{
|
{
|
||||||
@@ -23,11 +22,14 @@ namespace Content.IntegrationTests
|
|||||||
protected sealed override ClientIntegrationInstance StartClient(ClientIntegrationOptions options = null)
|
protected sealed override ClientIntegrationInstance StartClient(ClientIntegrationOptions options = null)
|
||||||
{
|
{
|
||||||
options ??= new ClientIntegrationOptions();
|
options ??= new ClientIntegrationOptions();
|
||||||
options.ExtraAssemblies = new[] {typeof(ContentIntegrationTest).Assembly};
|
|
||||||
|
|
||||||
// ReSharper disable once RedundantNameQualifier
|
// ReSharper disable once RedundantNameQualifier
|
||||||
options.ClientContentAssembly = typeof(EntryPoint).Assembly;
|
options.ContentAssemblies = new[]
|
||||||
options.SharedContentAssembly = typeof(Shared.EntryPoint).Assembly;
|
{
|
||||||
|
typeof(Shared.EntryPoint).Assembly,
|
||||||
|
typeof(Client.EntryPoint).Assembly,
|
||||||
|
typeof(ContentIntegrationTest).Assembly
|
||||||
|
};
|
||||||
|
|
||||||
options.BeforeStart += () =>
|
options.BeforeStart += () =>
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IModLoader>().SetModuleBaseCallbacks(new ClientModuleTestingCallbacks
|
IoCManager.Resolve<IModLoader>().SetModuleBaseCallbacks(new ClientModuleTestingCallbacks
|
||||||
@@ -54,9 +56,12 @@ namespace Content.IntegrationTests
|
|||||||
protected override ServerIntegrationInstance StartServer(ServerIntegrationOptions options = null)
|
protected override ServerIntegrationInstance StartServer(ServerIntegrationOptions options = null)
|
||||||
{
|
{
|
||||||
options ??= new ServerIntegrationOptions();
|
options ??= new ServerIntegrationOptions();
|
||||||
options.ExtraAssemblies = new[] {typeof(ContentIntegrationTest).Assembly};
|
options.ContentAssemblies = new[]
|
||||||
options.ServerContentAssembly = typeof(Server.EntryPoint).Assembly;
|
{
|
||||||
options.SharedContentAssembly = typeof(Shared.EntryPoint).Assembly;
|
typeof(Shared.EntryPoint).Assembly,
|
||||||
|
typeof(Server.EntryPoint).Assembly,
|
||||||
|
typeof(ContentIntegrationTest).Assembly
|
||||||
|
};
|
||||||
options.BeforeStart += () =>
|
options.BeforeStart += () =>
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IModLoader>().SetModuleBaseCallbacks(new ServerModuleTestingCallbacks
|
IoCManager.Resolve<IModLoader>().SetModuleBaseCallbacks(new ServerModuleTestingCallbacks
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using Robust.Shared.Interfaces.Map;
|
|||||||
using Robust.Shared.Interfaces.Timing;
|
using Robust.Shared.Interfaces.Timing;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Reflection;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests.Networking
|
namespace Content.IntegrationTests.Tests.Networking
|
||||||
@@ -425,6 +426,7 @@ namespace Content.IntegrationTests.Tests.Networking
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Reflect(false)]
|
||||||
private sealed class PredictionTestEntitySystem : EntitySystem
|
private sealed class PredictionTestEntitySystem : EntitySystem
|
||||||
{
|
{
|
||||||
public bool Allow { get; set; } = true;
|
public bool Allow { get; set; } = true;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using NUnit.Framework;
|
|||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Reflection;
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests
|
namespace Content.IntegrationTests.Tests
|
||||||
{
|
{
|
||||||
@@ -13,6 +14,7 @@ namespace Content.IntegrationTests.Tests
|
|||||||
[TestOf(typeof(IResettingEntitySystem))]
|
[TestOf(typeof(IResettingEntitySystem))]
|
||||||
public class ResettingEntitySystemTests : ContentIntegrationTest
|
public class ResettingEntitySystemTests : ContentIntegrationTest
|
||||||
{
|
{
|
||||||
|
[Reflect(false)]
|
||||||
private class TestResettingEntitySystem : EntitySystem, IResettingEntitySystem
|
private class TestResettingEntitySystem : EntitySystem, IResettingEntitySystem
|
||||||
{
|
{
|
||||||
public bool HasBeenReset { get; set; }
|
public bool HasBeenReset { get; set; }
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
using Content.Client;
|
using Content.Client;
|
||||||
using Content.Server;
|
using Content.Server;
|
||||||
using Robust.UnitTesting;
|
using Robust.UnitTesting;
|
||||||
@@ -19,5 +21,26 @@ namespace Content.Tests
|
|||||||
ClientContentIoC.Register();
|
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
|
// in a unit test
|
||||||
|
|
||||||
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
|
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
|
||||||
prototypeManager.RegisterType(typeof(AlertPrototype));
|
|
||||||
var factory = IoCManager.Resolve<IComponentFactory>();
|
var factory = IoCManager.Resolve<IComponentFactory>();
|
||||||
factory.Register<ServerAlertsComponent>();
|
factory.Register<ServerAlertsComponent>();
|
||||||
prototypeManager.LoadFromStream(new StringReader(PROTOTYPES));
|
prototypeManager.LoadFromStream(new StringReader(PROTOTYPES));
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ using YamlDotNet.RepresentationModel;
|
|||||||
namespace Content.Tests.Shared.Alert
|
namespace Content.Tests.Shared.Alert
|
||||||
{
|
{
|
||||||
[TestFixture, TestOf(typeof(AlertManager))]
|
[TestFixture, TestOf(typeof(AlertManager))]
|
||||||
public class AlertManagerTests : RobustUnitTest
|
public class AlertManagerTests : ContentUnitTest
|
||||||
{
|
{
|
||||||
const string PROTOTYPES = @"
|
const string PROTOTYPES = @"
|
||||||
- type: alert
|
- type: alert
|
||||||
@@ -28,9 +28,7 @@ namespace Content.Tests.Shared.Alert
|
|||||||
public void TestAlertManager()
|
public void TestAlertManager()
|
||||||
{
|
{
|
||||||
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
|
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
|
||||||
prototypeManager.RegisterType(typeof(AlertPrototype));
|
|
||||||
prototypeManager.LoadFromStream(new StringReader(PROTOTYPES));
|
prototypeManager.LoadFromStream(new StringReader(PROTOTYPES));
|
||||||
IoCManager.RegisterInstance<AlertManager>(new AlertManager());
|
|
||||||
var alertManager = IoCManager.Resolve<AlertManager>();
|
var alertManager = IoCManager.Resolve<AlertManager>();
|
||||||
alertManager.Initialize();
|
alertManager.Initialize();
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ using Robust.UnitTesting;
|
|||||||
namespace Content.Tests.Shared.Alert
|
namespace Content.Tests.Shared.Alert
|
||||||
{
|
{
|
||||||
[TestFixture, TestOf(typeof(AlertOrderPrototype))]
|
[TestFixture, TestOf(typeof(AlertOrderPrototype))]
|
||||||
public class AlertOrderPrototypeTests : RobustUnitTest
|
public class AlertOrderPrototypeTests : ContentUnitTest
|
||||||
{
|
{
|
||||||
const string PROTOTYPES = @"
|
const string PROTOTYPES = @"
|
||||||
- type: alertOrder
|
- type: alertOrder
|
||||||
@@ -64,8 +64,6 @@ namespace Content.Tests.Shared.Alert
|
|||||||
public void TestAlertOrderPrototype()
|
public void TestAlertOrderPrototype()
|
||||||
{
|
{
|
||||||
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
|
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
|
||||||
prototypeManager.RegisterType(typeof(AlertPrototype));
|
|
||||||
prototypeManager.RegisterType(typeof(AlertOrderPrototype));
|
|
||||||
prototypeManager.LoadFromStream(new StringReader(PROTOTYPES));
|
prototypeManager.LoadFromStream(new StringReader(PROTOTYPES));
|
||||||
|
|
||||||
var alertOrder = prototypeManager.EnumeratePrototypes<AlertOrderPrototype>().FirstOrDefault();
|
var alertOrder = prototypeManager.EnumeratePrototypes<AlertOrderPrototype>().FirstOrDefault();
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ using YamlDotNet.RepresentationModel;
|
|||||||
namespace Content.Tests.Shared.Alert
|
namespace Content.Tests.Shared.Alert
|
||||||
{
|
{
|
||||||
[TestFixture, TestOf(typeof(AlertPrototype))]
|
[TestFixture, TestOf(typeof(AlertPrototype))]
|
||||||
public class AlertPrototypeTests : RobustUnitTest
|
public class AlertPrototypeTests : ContentUnitTest
|
||||||
{
|
{
|
||||||
private const string PROTOTYPE = @"- type: alert
|
private const string PROTOTYPE = @"- type: alert
|
||||||
alertType: HumanHealth
|
alertType: HumanHealth
|
||||||
|
|||||||
Reference in New Issue
Block a user