-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWorldTestBase.cs
More file actions
33 lines (30 loc) · 1.05 KB
/
WorldTestBase.cs
File metadata and controls
33 lines (30 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using NUnit.Framework;
using Unity.Entities;
using System.Linq;
namespace E7.EcsTesting
{
/// <summary>
/// Base class to begin writing a world-based test. It pours all systems available in to the world, plus
/// one more system which allows you to <see cref="EcsTestBase.ForceDeltaTime"/> to change delta time of the next update.
///
/// You then create some entities and run `w.Update()` in sequences and check results.
/// </summary>
public abstract class WorldTestBase : EcsTestBase
{
[SetUp]
public void SetUp()
{
SetUpBase();
SetUpWorld();
}
[TearDown]
public void TearDown() => TearDownBase();
private void SetUpWorld()
{
var allSystems =
DefaultWorldInitialization.GetAllSystems(WorldSystemFilterFlags.Default, requireExecuteAlways: false);
DefaultWorldInitialization.AddSystemsToRootLevelSystemGroups(w,
allSystems.Concat(new[] {typeof(ConstantDeltaTimeSystem)}));
}
}
}