public void ClearTest()
    {
        var store = new ValueStore();

        IniAdapter.Load(store, ini);

        var node = store.AddRoot("Superfluous", "Value");

        node.AddChild("Child", "Value");

        var profile = new RuntimeProfile();

        profile.Store = store;
        profile.CleanStore();

        Assert.IsNull(profile.GetOption("Superfluous/Child"));
        Assert.IsNull(profile.GetOption("Superfluous"));

        var option = profile.GetOption("ParentDummy");

        Assert.IsNotNull(option);
        Assert.IsTrue(option.Save() == "no");

        option = profile.GetOption("ParentDummy/Child2:Child2Variant2/Child3/Child4/Child5:Default1");
        Assert.IsNotNull(option);
        Assert.IsNotNull(option.Save() == "Child5Default1Value");
    }
    public void EditorTest()
    {
        var rnd   = new System.Random(42);
        var store = new ValueStore();

        for (int i = 0; i < 10; i++)
        {
            var name = "Root_" + i;
            var root = store.AddRoot(name, name + "_Value");
            PopulateNode(root, rnd, name, 1);
        }

        var clone = new List <ValueStore.Node>(store.RootCount);

        foreach (var root in store.Roots)
        {
            clone.Add(root.Clone());
        }

        var receiver = (ISerializationCallbackReceiver)store;

        receiver.OnBeforeSerialize();
        receiver.OnAfterDeserialize();

        /*var builder = new StringBuilder();
         * foreach (var node in clone) {
         *  PrintRecursive(node, 0, builder);
         * }
         * File.WriteAllText("/Users/adrian/Desktop/test1.out", builder.ToString());
         *
         * builder = new StringBuilder();
         * foreach (var node in store.nodes) {
         *  PrintRecursive(node, 0, builder);
         * }
         * File.WriteAllText("/Users/adrian/Desktop/test2.out", builder.ToString());*/

        Assert.AreEqual(store.RootCount, clone.Count);

        int j = 0;

        foreach (var root in store.Roots)
        {
            AssertRecursive(root, clone[j++]);
        }
    }
    public void Test()
    {
        var store = new ValueStore();

        IniAdapter.Load(store, ini);

        var node = store.AddRoot("Superfluous", "Value");

        node.AddChild("Child", "Value");

        var profile = new RuntimeProfile();

        profile.Store = store;
        profile.SaveToStore();

        var newIni = IniAdapter.Save(profile.Store);

        System.IO.File.WriteAllText("/Users/adrian/Desktop/orig.ini", SortAndTrim(ini));
        System.IO.File.WriteAllText("/Users/adrian/Desktop/new.ini", SortAndTrim(newIni));
        Assert.True(SortAndTrim(ini) == SortAndTrim(newIni));
    }