Пример #1
0
        public void DeepEqualsFailsCorrectly()
        {
            VValue val1 = new VValue("value1");
            VValue val2 = new VValue("value2");

            Assert.False(VToken.DeepEquals(val1, val2));
        }
Пример #2
0
        public void DeepEqualsSucceedsCorrectly()
        {
            VValue val1 = new VValue("value1");
            VValue val2 = new VValue("value1");

            Assert.True(VToken.DeepEquals(val1, val2));
        }
Пример #3
0
        public void CommentsDeserializeCorrectly()
        {
            const string vdf    = @"
                // Comment type A (at the start of the file)
                ""root""
                {
                    // Comment type B (as a child to an object)
                    key1 ""value1""
                    ""key2"" // Comment type C (to the right of a property name)
                    {
                        ""key3"" ""value3"" // Comment type D (to the right of a property value)
                    }
                }
                // Comment type E (at the end of the file)
            ";
            VProperty    result = VdfConvert.Deserialize(vdf);

            VProperty expected = new VProperty("root", new VObject
            {
                VValue.CreateComment(" Comment type B (as a child to an object)"),
                new VProperty("key1", new VValue("value1")),
                new VProperty("key2", new VObject
                {
                    new VProperty("key3", new VValue("value3")),
                    VValue.CreateComment(" Comment type D (to the right of a property value)"),
                }),
            });

            Assert.True(VToken.DeepEquals(result, expected));
        }
Пример #4
0
        public void DeepEqualsSucceedsCorrectly()
        {
            VProperty prop1 = new VProperty("key1", new VValue("value1"));
            VProperty prop2 = new VProperty("key1", new VValue("value1"));

            Assert.True(VToken.DeepEquals(prop1, prop2));
        }
Пример #5
0
        public void DeepEqualsFailsCorrectly()
        {
            VProperty prop1 = new VProperty("key1", new VValue("value1"));
            VProperty prop2 = new VProperty("key2", new VValue("value1"));
            VProperty prop3 = new VProperty("key1", new VValue("value2"));

            Assert.False(VToken.DeepEquals(prop1, prop2));
            Assert.False(VToken.DeepEquals(prop1, prop3));
        }
Пример #6
0
        public void DeepEqualsFailsCorrectly()
        {
            VObject obj1 = new VObject
            {
                new VProperty("key1", new VValue("value1")),
                new VProperty("key2", new VValue("value2")),
            };

            VObject obj2 = new VObject
            {
                new VProperty("key1", new VValue("value1")),
                new VProperty("key2", new VValue("value3")),
            };

            Assert.False(VToken.DeepEquals(obj1, obj2));
        }
Пример #7
0
        public void DoubleSlashInValueDeserializesCorrectly()
        {
            const string vdf    = @"
                ""root""
                {
                    ""key1"" ""//""
                }
            ";
            VProperty    result = VdfConvert.Deserialize(vdf);

            VProperty expected = new VProperty("root", new VObject
            {
                new VProperty("key1", new VValue("//")),
            });

            Assert.True(VToken.DeepEquals(result, expected));
        }