-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Validation for disconnected dependencies
- Loading branch information
1 parent
06e66cc
commit aac53ea
Showing
18 changed files
with
346 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
Arch.SystemGroups.Tests/DisconnectedDependencies/DisconnectedDependenciesTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Arch.SystemGroups.Tests.TestSetup1; | ||
using NSubstitute; | ||
|
||
namespace Arch.SystemGroups.Tests.DisconnectedDependencies; | ||
|
||
public class DisconnectedDependenciesTests | ||
{ | ||
private ArchSystemsWorldBuilder<TestWorld> _worldBuilder; | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
_worldBuilder = new ArchSystemsWorldBuilder<TestWorld>(new TestWorld(), Substitute.For<IPlayerLoop>()); | ||
} | ||
|
||
[Test] | ||
public void ThrowsOnSystems() | ||
{ | ||
DDSystem1.InjectToWorld(ref _worldBuilder); | ||
DDSystem2.InjectToWorld(ref _worldBuilder); | ||
|
||
Assert.Throws<DisconnectedDependenciesFoundException>(() => _worldBuilder.Finish()); | ||
} | ||
|
||
[Test] | ||
public void ThrowsOnGroups() | ||
{ | ||
DDSystem1Gr1.InjectToWorld(ref _worldBuilder); | ||
DDSystem1Gr2.InjectToWorld(ref _worldBuilder); | ||
|
||
Assert.Throws<DisconnectedDependenciesFoundException>(() => _worldBuilder.Finish()); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
Arch.SystemGroups.Tests/DisconnectedDependencies/Groups.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Arch.SystemGroups.DefaultSystemGroups; | ||
|
||
namespace Arch.SystemGroups.Tests.DisconnectedDependencies; | ||
|
||
[UpdateInGroup(typeof(PresentationSystemGroup))] | ||
public partial class DDGroup1 | ||
{ | ||
|
||
} | ||
|
||
[UpdateInGroup(typeof(SimulationSystemGroup))] | ||
[UpdateBefore(typeof(DDGroup1))] | ||
public partial class DDGroup2 | ||
{ | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
Arch.SystemGroups.Tests/DisconnectedDependencies/Systems.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using Arch.System; | ||
using Arch.SystemGroups.DefaultSystemGroups; | ||
using Arch.SystemGroups.Tests.TestSetup1; | ||
|
||
namespace Arch.SystemGroups.Tests.DisconnectedDependencies; | ||
|
||
[UpdateInGroup(typeof(PostRenderingSystemGroup))] | ||
[UpdateAfter(typeof(DDSystem2))] // exception | ||
public partial class DDSystem1 : BaseSystem<TestWorld, float> | ||
{ | ||
public DDSystem1(TestWorld world) : base(world) | ||
{ | ||
} | ||
} | ||
|
||
[UpdateInGroup(typeof(SimulationSystemGroup))] | ||
public partial class DDSystem2 : BaseSystem<TestWorld, float> | ||
{ | ||
public DDSystem2(TestWorld world) : base(world) | ||
{ | ||
} | ||
} | ||
|
||
[UpdateInGroup(typeof(DDGroup1))] | ||
public partial class DDSystem1Gr1 : BaseSystem<TestWorld, float> | ||
{ | ||
public DDSystem1Gr1(TestWorld world) : base(world) | ||
{ | ||
} | ||
} | ||
|
||
[UpdateInGroup(typeof(DDGroup2))] | ||
public partial class DDSystem1Gr2 : BaseSystem<TestWorld, float> | ||
{ | ||
public DDSystem1Gr2(TestWorld world) : base(world) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Arch.System; | ||
using Arch.SystemGroups.DefaultSystemGroups; | ||
using Arch.SystemGroups.Tests.TestSetup1; | ||
|
||
namespace Arch.SystemGroups.Tests.GenericSetup; | ||
|
||
public class ParentClass<T> | ||
{ | ||
public class NestedType | ||
{ | ||
public T Value; | ||
} | ||
} | ||
|
||
public struct ParamGen | ||
{ | ||
public bool Value; | ||
} | ||
|
||
[UpdateInGroup(typeof(SimulationSystemGroup))] | ||
public partial class SystemWithGenericNestedArgument : BaseSystem<TestWorld, float> | ||
{ | ||
private readonly ParentClass<ParamGen>.NestedType _param; | ||
|
||
internal SystemWithGenericNestedArgument(TestWorld world, ParentClass<ParamGen>.NestedType param) : base(world) | ||
{ | ||
_param = param; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.