Add prototype serialization tests. (#18458)

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Leon Friedrich
2023-08-06 14:47:45 +12:00
committed by GitHub
parent b97be440dd
commit 28a5e32f5e
18 changed files with 138 additions and 53 deletions

View File

@@ -1,4 +1,6 @@
using Robust.Shared.Prototypes;
using System.Linq;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Shared.Alert
{
@@ -14,22 +16,25 @@ namespace Content.Shared.Alert
public string ID { get; } = default!;
[DataField("order")]
private List<(string type, string alert)> Order
private (string type, string alert)[] Order
{
// why would paul do this to me.
get
{
var res = new List<(string, string)>(_typeToIdx.Count + _categoryToIdx.Count);
var res = new (string, string)[_typeToIdx.Count + _categoryToIdx.Count];
foreach (var (type, id) in _typeToIdx)
{
res.Insert(id, ("alertType", type.ToString()));
res[id] = ("alertType", type.ToString());
}
foreach (var (category, id) in _categoryToIdx)
{
res.Insert(id, ("category", category.ToString()));
res[id] = ("category", category.ToString());
}
DebugTools.Assert(res.All(x => x != default));
return res;
}
set