Ejemplo n.º 1
0
            public void WhenSimpleState_IsEqual_ReturnsNull()
            {
                var objectData = new StateObjectData("tn", ImmutableDictionary <string, ObjectData> .Empty, hasKey: false, key: null);
                var current    = new StateObjectTreeItem(null, "pn", objectData, depth: 0);
                var next       = new StateObjectTreeItem(null, "pn", objectData, depth: 0);

                var actual = TreeComparer.CreateDifferenceTree(current, next);

                Assert.That(actual, Is.Null);
            }
Ejemplo n.º 2
0
        public StateObjectTreeItem(ObjectTreeItem parent, string propertyName, StateObjectData source, int depth) :
            base(parent, propertyName, source)
        {
            var properties = new List <ObjectTreeItem>(source.Properties.Count);

            foreach (var item in source.Properties)
            {
                properties.Add(StateFormatter.ToTreeHierarchy(this, item.Value, depth + 1, item.Key));
            }
            Children = properties.ToArray();
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates <see cref=" StateObjectTreeItem"/>. Besides properties it could implement either a <see cref="IDictionary"/> or <see cref="IEnumerable"/>
 /// but not both.
 /// </summary>
 /// <param name="depth"></param>
 /// <param name="propertyName"></param>
 /// <param name="source"></param>
 /// <returns></returns>
 public static StateObjectTreeItem FormatState(ObjectTreeItem parent, int depth, string propertyName, StateObjectData source)
 {
     return(new StateObjectTreeItem(parent, propertyName, source, depth));
 }
Ejemplo n.º 4
0
        public StateObjectTreeItem CreateKeyedStateObjectTreeItem(object key, params PrimitiveObjectTreeItem[] children)
        {
            var data = new StateObjectData("tn", children.ToImmutableDictionary(c => c.PropertyName, c => c.Source), hasKey: true, key: key);

            return(new StateObjectTreeItem(null, "sn", data, depth: 0));
        }