Use linter for vendingmachinetest (#12445)

Probably fixes the dependency issue
This commit is contained in:
metalgearsloth
2022-11-09 07:39:15 +11:00
committed by GitHub
parent 42de86ea85
commit 18961f79c2
2 changed files with 4 additions and 44 deletions

View File

@@ -1,41 +0,0 @@
using System.Threading.Tasks;
using Content.Shared.VendingMachines;
using NUnit.Framework;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
namespace Content.IntegrationTests.Tests
{
[TestFixture]
[TestOf(typeof(VendingMachineInventoryPrototype))]
public sealed class VendingMachineTest
{
[Test]
public async Task Test()
{
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings{NoClient = true});
var server = pairTracker.Pair.Server;
await server.WaitAssertion(() =>
{
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
foreach (var vendorProto in prototypeManager.EnumeratePrototypes<VendingMachineInventoryPrototype>())
{
foreach (var (item, _) in vendorProto.StartingInventory)
{
try
{
prototypeManager.Index<EntityPrototype>(item);
}
catch (UnknownPrototypeException)
{
throw new UnknownPrototypeException($"Unknown prototype {item} on vending inventory {vendorProto.ID}");
}
}
}
});
await pairTracker.CleanReturnAsync();
}
}
}

View File

@@ -1,5 +1,6 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
namespace Content.Shared.VendingMachines
{
@@ -10,13 +11,13 @@ namespace Content.Shared.VendingMachines
[IdDataField]
public string ID { get; } = default!;
[DataField("startingInventory")]
[DataField("startingInventory", customTypeSerializer:typeof(PrototypeIdDictionarySerializer<uint, EntityPrototype>))]
public Dictionary<string, uint> StartingInventory { get; } = new();
[DataField("emaggedInventory")]
[DataField("emaggedInventory", customTypeSerializer:typeof(PrototypeIdDictionarySerializer<uint, EntityPrototype>))]
public Dictionary<string, uint>? EmaggedInventory { get; }
[DataField("contrabandInventory")]
[DataField("contrabandInventory", customTypeSerializer:typeof(PrototypeIdDictionarySerializer<uint, EntityPrototype>))]
public Dictionary<string, uint>? ContrabandInventory { get; }
}
}