public void DebuggerAttributesValid()
        {
            DebuggerAttributes.ValidateDebuggerDisplayReferences(
                ImmutableSegmentedDictionary.Create <int, int>()
                );
            ImmutableSegmentedDictionary <string, int> dict = ImmutableSegmentedDictionary
                                                              .Create <string, int>()
                                                              .Add("One", 1)
                                                              .Add("Two", 2);
            DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(
                dict
                );

            object rootNode =
                DebuggerAttributes.GetFieldValue(
                    ImmutableSegmentedDictionary.Create <string, string>(),
                    "_root"
                    ) ?? throw new InvalidOperationException();

            DebuggerAttributes.ValidateDebuggerDisplayReferences(rootNode);
            PropertyInfo itemProperty = info.Properties.Single(
                pr =>
                pr.GetCustomAttribute <DebuggerBrowsableAttribute>() !.State
                == DebuggerBrowsableState.RootHidden
                );

            KeyValuePair <string, int>[]? items =
                itemProperty.GetValue(info.Instance) as KeyValuePair <string, int>[];
            Assert.Equal(dict, items);
        }
Exemplo n.º 2
0
        internal static void InvokeDebuggerTypeProxyProperties(object obj)
        {
            DebuggerAttributeInfo info = ValidateDebuggerTypeProxyProperties(obj.GetType(), obj);

            foreach (PropertyInfo pi in info.Properties)
            {
                pi.GetValue(info.Instance, null);
            }
        }
Exemplo n.º 3
0
        public void DebuggerAttributesValid()
        {
            DebuggerAttributes.ValidateDebuggerDisplayReferences(ImmutableSegmentedHashSet.Create <string>());
            ImmutableSegmentedHashSet <int> set  = ImmutableSegmentedHashSet.Create(1, 2, 3);
            DebuggerAttributeInfo           info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(set);
            PropertyInfo itemProperty            = info.Properties.Single(pr => pr.GetCustomAttribute <DebuggerBrowsableAttribute>()?.State == DebuggerBrowsableState.RootHidden);

            int[]? items = itemProperty.GetValue(info.Instance) as int[];
            Assert.Equal(set, items);
        }
        public void DebuggerAttributesValid()
        {
            DebuggerAttributes.ValidateDebuggerDisplayReferences(ImmutableSegmentedDictionary.CreateBuilder <string, int>());
            ImmutableSegmentedDictionary <int, string> .Builder builder = ImmutableSegmentedDictionary.CreateBuilder <int, string>();
            builder.Add(1, "One");
            builder.Add(2, "Two");
            DebuggerAttributeInfo info         = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(builder);
            PropertyInfo          itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute <DebuggerBrowsableAttribute>() !.State == DebuggerBrowsableState.RootHidden);

            KeyValuePair <int, string>[]? items = itemProperty.GetValue(info.Instance) as KeyValuePair <int, string>[];
            Assert.Equal(builder, items);
        }
        public void DebuggerAttributesValid()
        {
            DebuggerAttributes.ValidateDebuggerDisplayReferences(ImmutableSegmentedList.Create <int>());
            ImmutableSegmentedList <double> list = ImmutableSegmentedList.Create <double>(1, 2, 3);
            DebuggerAttributeInfo           info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(list);

            object?rootNode = DebuggerAttributes.GetFieldValue(ImmutableSegmentedList.Create <string>("1", "2", "3"), "_root") !;

            DebuggerAttributes.ValidateDebuggerDisplayReferences(rootNode);
            PropertyInfo itemProperty = info.Properties.Single(pr => pr.GetCustomAttribute <DebuggerBrowsableAttribute>() !.State == DebuggerBrowsableState.RootHidden);

            double[]? items = itemProperty.GetValue(info.Instance) as double[];
            Assert.Equal(list, items);
        }