public void then_can_deserialize() { BitStream _BitStream = new BitStream(); List <Variable> vars = new List <Variable>() { new IntegerVariable(0, "var1") { MinValue = 0, MaxValue = 16 }, new IntegerVariable(2, "var3") { MinValue = 0, MaxValue = 38 }, new BoolVariable(1, "var2") }; ExperimentSerializer serializer = new ExperimentSerializer(vars); Dictionary <int, double> newValues = new Dictionary <int, double>() { { 0, 8 }, { 1, 1 } }; serializer.Serialize(newValues, _BitStream); _BitStream.Position = 0; Dictionary <int, double> deserialize = serializer.Deserialize(_BitStream); deserialize[0].ShouldEqual(newValues[0]); deserialize[1].ShouldEqual(newValues[1]); }
public void then_can_serialize() { BitStream BitStream = new BitStream(); List <Variable> vars = new List <Variable>() { new IntegerVariable(0, "var1") { MinValue = 0, MaxValue = 16 }, new BoolVariable(1, "var2") }; ExperimentSerializer serializer = new ExperimentSerializer(vars); Dictionary <int, double> newValues = new Dictionary <int, double>() { { 0, 8 }, { 1, 1 } }; serializer.Serialize(newValues, BitStream); BitStream.ToByteArray()[0].ShouldEqual((byte)17); }