Add material arbitrage tests (#13315)

This commit is contained in:
Leon Friedrich
2023-01-15 21:57:59 +13:00
committed by GitHub
parent 9f3256730d
commit cf509c1e38
28 changed files with 415 additions and 34 deletions

View File

@@ -31,15 +31,19 @@ public sealed class CargoTest
{
var mapId = testMap.MapId;
foreach (var proto in protoManager.EnumeratePrototypes<CargoProductPrototype>())
Assert.Multiple(() =>
{
var ent = entManager.SpawnEntity(proto.Product, new MapCoordinates(Vector2.Zero, mapId));
var price = pricing.GetPrice(ent);
foreach (var proto in protoManager.EnumeratePrototypes<CargoProductPrototype>())
{
var ent = entManager.SpawnEntity(proto.Product, new MapCoordinates(Vector2.Zero, mapId));
var price = pricing.GetPrice(ent);
Assert.That(price, Is.LessThan(proto.PointCost), $"Found arbitrage on {proto.ID} cargo product! Cost is {proto.PointCost} but sell is {price}!");
entManager.DeleteEntity(ent);
}
Assert.That(price, Is.LessThan(proto.PointCost), $"Found arbitrage on {proto.ID} cargo product! Cost is {proto.PointCost} but sell is {price}!");
entManager.DeleteEntity(ent);
}
});
mapManager.DeleteMap(mapId);
});