Ejemplo n.º 1
0
        public void DeepFreeze()
        {
            var deep = new FreezeInside("root")
                           {
                               Single = new FreezeInside("single"),
                               Multiple = new[] {new FreezeInside("item1"), new FreezeInside("item2")}
                           };

            var frozen = deep.MakeFreezable<IFreezeInside>();
            frozen.Freeze();

            frozen.Single.IsFrozen().ShouldBeTrue();

            frozen.Multiple[0].IsFrozen().ShouldBeTrue();
            frozen.Multiple[1].IsFrozen().ShouldBeTrue();
        }
Ejemplo n.º 2
0
        public void DeepClone()
        {
            var deep = new FreezeInside("root")
                           {
                               Single = new FreezeInside("single"),
                               Multiple = new[] {new FreezeInside("item1"), new FreezeInside("item2")}
                           };

            var frozen = deep.MakeFreezable<IFreezeInside>();
            frozen.Freeze();

            IFreezeInside clone = frozen.CloneUnfrozen();

            clone.Single.IsFrozen().ShouldBeFalse();

            clone.Multiple[0].IsFrozen().ShouldBeFalse();
            clone.Multiple[1].IsFrozen().ShouldBeFalse();
        }