예제 #1
0
        public void MapPresentation()
        {
            var obj = new MapImpl();

            obj.Insert(ValueFactory.Create("first"), ValueFactory.Create(1));
            obj.Insert(ValueFactory.Create("second"), ValueFactory.Create(2));

            var debuggerVar = Visualizer.GetVariable(Variable.Create(obj, "myVar"));

            Assert.That(debuggerVar.Presentation, Is.EqualTo("Соответствие"));
            Assert.That(debuggerVar.IsStructured, Is.True);

            var items = Visualizer.GetChildVariables(obj)
                        .Select(x => Visualizer.GetVariable(x))
                        .ToArray();

            Assert.That(items, Has.Length.EqualTo(2));
            Assert.That(items[0].Name, Is.EqualTo("0"));
            Assert.That(items[0].TypeName, Is.EqualTo("КлючИЗначение"));
            Assert.That(items[0].Presentation, Is.EqualTo("КлючИЗначение"));
            Assert.That(items[0].IsStructured, Is.True);

            Assert.That(items[1].Name, Is.EqualTo("1"));
            Assert.That(items[1].TypeName, Is.EqualTo("КлючИЗначение"));
            Assert.That(items[1].Presentation, Is.EqualTo("КлючИЗначение"));
            Assert.That(items[1].IsStructured, Is.True);

            var keyValue = Visualizer.GetChildVariables(obj.First())
                           .Select(x => Visualizer.GetVariable(x))
                           .ToArray();

            Assert.That(keyValue[0].Name, Is.EqualTo("Ключ"));
            Assert.That(keyValue[0].Presentation, Is.EqualTo("first"));
            Assert.That(keyValue[1].Name, Is.EqualTo("Значение"));
            Assert.That(keyValue[1].Presentation, Is.EqualTo("1"));
        }