Exemplo n.º 1
0
        public void Trees_only_compare_using_referenceEquals()
        {
            var tree1 = Sigo.Create(3).Set1("k", Sigo.From("v"));
            var tree2 = Sigo.Create(3).Set1("k", Sigo.From("v"));

            SigoAssert.True(Sigo.Same(tree1, tree1));

            SigoAssert.False(Sigo.Same(tree1, tree2));
        }
Exemplo n.º 2
0
        public void Leafs_compare_data_using_equals()
        {
            var v1 = Sigo.From("v");
            var v2 = Sigo.From("v");
            var x1 = Sigo.From("x");

            SigoAssert.True(Sigo.Same(v1, v1));
            SigoAssert.True(Sigo.Same(v1, v2));

            SigoAssert.False(Sigo.Same(v1, x1));
        }
Exemplo n.º 3
0
        public void NonEmptyTree_areNotFrozen_after_creating_or_changing()
        {
            // non empty tree are not frozen after creating
            SigoAssert.False(tree.IsFrozen());

            // not frozen after changing
            tree = tree.Freeze().Set1("v", Sigo.From("v+"));
            SigoAssert.False(tree.IsFrozen());

            // leafs and elements are frozen always frozen
            SigoAssert.True(leaf.IsFrozen());
            SigoAssert.True(e3.IsFrozen());
        }
Exemplo n.º 4
0
        public void NonFrozen_return_new_obj()
        {
            var user = Sigo.Create(3,
                                   "name", Sigo.Create(3,
                                                       "first", "Phat",
                                                       "last", "Dam"),
                                   "frozen", Sigo.Create(0, "k", "v").Freeze()
                                   );

            SigoAssert.False(user.IsFrozen());
            SigoAssert.False(user.Get("name").IsFrozen());
            SigoAssert.True(user.Get("frozen").IsFrozen());

            var clone = user.Clone();

            SigoAssert.NotSame(user, clone);
            SigoAssert.NotSame(user.Get("name"), clone.Get("name"));
            SigoAssert.Same(user.Get("frozen"), clone.Get("frozen"));
        }