using Vellum; namespace Clave.Vellum.UnitTests { public static class SavedThrough { public static SaveSession Session() { return SaveConverters.For(typeof(SavedThrough).Assembly).CreateSession(); } public static SaveNode LuaText(SaveNode node) { SaveNode save = SaveNode.NewTable(); save.Entries["value"] = node; return LuaSaveFormat.Parse(LuaSaveFormat.Format(save)).RequireEntry("value"); } public static ValueType RoundTrip(ValueType value) { SaveSession session = Session(); return (ValueType)session.FromNode(LuaText(session.ToNode(value, typeof(ValueType))), typeof(ValueType)); } public static SaveNode Terms(params string[] terms) { SaveNode returnMe = SaveNode.NewList(); foreach (string term in terms) { returnMe.Items.Add(SaveNode.OfText(term)); } return returnMe; } } }