diff --git a/Content.IntegrationTests/Tests/Construction/ConstructionPrototypeTest.cs b/Content.IntegrationTests/Tests/Construction/ConstructionPrototypeTest.cs new file mode 100644 index 0000000000..9eea03ee70 --- /dev/null +++ b/Content.IntegrationTests/Tests/Construction/ConstructionPrototypeTest.cs @@ -0,0 +1,66 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Content.Shared.Construction.Prototypes; +using NUnit.Framework; +using Robust.Shared.Prototypes; + +namespace Content.IntegrationTests.Tests.Construction +{ + [TestFixture] + public sealed class ConstructionPrototypeTest : ContentIntegrationTest + { + [Test] + public async Task TestStartIsValid() + { + var server = StartServerDummyTicker(); + + await server.WaitIdleAsync(); + + var protoMan = server.ResolveDependency(); + + foreach (var proto in protoMan.EnumeratePrototypes()) + { + var start = proto.StartNode; + var graph = protoMan.Index(proto.Graph); + + Assert.That(graph.Nodes.ContainsKey(start), $"Found no startNode \"{start}\" on graph \"{graph.ID}\" for construction prototype \"{proto.ID}\"!"); + } + } + + [Test] + public async Task TestTargetIsValid() + { + var server = StartServerDummyTicker(); + + await server.WaitIdleAsync(); + + var protoMan = server.ResolveDependency(); + + foreach (var proto in protoMan.EnumeratePrototypes()) + { + var target = proto.TargetNode; + var graph = protoMan.Index(proto.Graph); + + Assert.That(graph.Nodes.ContainsKey(target), $"Found no targetNode \"{target}\" on graph \"{graph.ID}\" for construction prototype \"{proto.ID}\"!"); + } + } + + [Test] + public async Task TestStartReachesTarget() + { + var server = StartServerDummyTicker(); + + await server.WaitIdleAsync(); + + var protoMan = server.ResolveDependency(); + + foreach (var proto in protoMan.EnumeratePrototypes()) + { + var start = proto.StartNode; + var target = proto.TargetNode; + var graph = protoMan.Index(proto.Graph); + Assert.That(graph.TryPath(start, target, out _), $"Unable to find path from \"{start}\" to \"{target}\" on graph \"{graph.ID}\""); + } + } + } +}