Ejemplo n.º 1
0
        public void CanSerializeStacks()
        {
            var stack = new StackValue();
            var nested = new StackValue();

            stack.Push(new StringValue("item1"));
            stack.Push(new ScalarIntValue(2));
            stack.Push(nested);

            nested.Push(new StringValue("nested1"));

            StackValue deserialized = Deserialize(Serialize(stack)) as StackValue;

            Assert.AreEqual(new StringValue("nested1"), (deserialized.Pop() as StackValue).Pop());
            Assert.AreEqual(new ScalarIntValue(2), deserialized.Pop());
            Assert.AreEqual(new StringValue("item1"), deserialized.Pop());
        }
Ejemplo n.º 2
0
        public void CanSerializeStacks()
        {
            var stack  = new StackValue();
            var nested = new StackValue();

            stack.Push(new StringValue("item1"));
            stack.Push(new ScalarIntValue(2));
            stack.Push(nested);

            nested.Push(new StringValue("nested1"));

            StackValue deserialized = Deserialize(Serialize(stack)) as StackValue;

            Assert.AreEqual(new StringValue("nested1"), (deserialized.Pop() as StackValue).Pop());
            Assert.AreEqual(new ScalarIntValue(2), deserialized.Pop());
            Assert.AreEqual(new StringValue("item1"), deserialized.Pop());
        }