示例#1
0
        public void SetListToItem()
        {
            var penis = new PENIS(File);

            penis.Set("Hey", new[] { 1, 2, 3 });
            penis.Set("Hey", 42);

            Assert.AreEqual(@"#comment
Ints:
    - 1 #comment
    - 2
    - 3
#another comment

Recursion:
    Ints:
        - 4
        - 5
        - 6
    Hey: no

#before
Hey: 42
#it's ending
", penis.Serialize());
        }
示例#2
0
文件: Program.cs 项目: pipe01/PiENIS
        static void Main(string[] args)
        {
            const string str = @"#first comment
some: element #inline comment
#another comment

other: element #in
#le comment";

            var file = new MemoryFile(str);
            var s    = new PENIS(file);

            Console.WriteLine(file.Content);

            s.Set("other", "i don't know");
            s.Save();
            Console.WriteLine("=============================");
            Console.WriteLine(file.Content);

            s.Remove("some");
            s.Save();
            Console.WriteLine("=============================");
            Console.WriteLine(file.Content);
            Console.ReadKey(true);
        }
示例#3
0
        public void AddList()
        {
            var penis = new PENIS(File);

            penis.Set("Foo", new[] { 1, 2, 3 });

            Assert.AreEqual(@"#comment
Ints:
    - 1 #comment
    - 2
    - 3
#another comment

Recursion:
    Ints:
        - 4
        - 5
        - 6
    Hey: no

#before
Hey: what's up #not much, hbu
#it's ending

Foo:
    - 1
    - 2
    - 3", penis.Serialize());
        }