using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Seshat; namespace Seshat.UnitTests { class InterleavedSchemaTests : UnitTestSharp.TestFixture { public void InterleavesDataInTable() { var table = new InterleavedSchemaTable(); table.NewRow().tuple = new Tuple("foo1", "bar1"); table.NewRow().tuple = new Tuple("foo2", "bar2"); table.NewRow().tuple = new Tuple("foo3", "bar3"); table.NewRow().tuple = new Tuple("foo4", "bar4"); var expected = new string[] { "foo1", "bar1", "foo2", "bar2", "foo3", "bar3", "foo4", "bar4", }; CheckEqual(expected, table.tuple); } public void RoundTripsThroughLuaSerialization() { var table = new InterleavedSchemaTable(); table.NewRow().tuple = new Tuple("foo1", "bar1"); table.NewRow().tuple = new Tuple("foo2", "bar2"); table.NewRow().tuple = new Tuple("foo3", "bar3"); table.NewRow().tuple = new Tuple("foo4", "bar4"); string serialized = table.SerializeToLuaTable(); var roundTrip = new InterleavedSchemaTable(); roundTrip.LoadFromLuaTable(serialized); var expected = new string[] { "foo1", "bar1", "foo2", "bar2", "foo3", "bar3", "foo4", "bar4", }; CheckEqual(expected, roundTrip.tuple); } } }