Exemplo n.º 1
0
        public int EnumChildrenImpl(enum_DEBUGPROP_INFO_FLAGS fields, uint radix, Guid guidFilter,
                                    enum_DBG_ATTRIB_FLAGS attributeFilter, string nameFilter,
                                    uint timeout, out IEnumDebugPropertyInfo2 propertyEnum)
        {
            propertyEnum = _taskExecutor.Run(() =>
            {
                _varInfo.FallbackValueFormat       = GetFallbackValueFormat(radix);
                IVariableInformation cachedVarInfo = _varInfo.GetCachedView();
                IChildrenProvider childrenProvider =
                    _childrenProviderFactory.Create(cachedVarInfo.GetChildAdapter(), fields, radix);

                return(_varInfoEnumFactory.Create(childrenProvider));
            });

            return(VSConstants.S_OK);
        }
Exemplo n.º 2
0
        public void GetPropertyInfoPointerValueEqualsAssignmentValue()
        {
            IVariableInformation mockVarInfoChild = Substitute.For <IVariableInformation>();

            mockVarInfoChild.AssignmentValue.Returns("1");
            mockVarInfoChild.ValueAsync().Returns("1");
            mockVarInfoChild.GetCachedView().Returns(mockVarInfoChild);

            mockVarInfo.Error.Returns(false);
            mockVarInfo.MightHaveChildren().Returns(true);
            mockVarInfo.IsPointer.Returns(true);
            mockVarInfo.AssignmentValue.Returns("0xDEADBEEF");
            mockVarInfo.ValueAsync().Returns("0xDEADBEEF");
            mockVarInfo.GetMemoryAddressAsHex().Returns("0xDEADBEEF");
            mockVarInfo.GetChildAdapter()
            .Returns(new ListChildAdapter.Factory().Create(new List <IVariableInformation>()
            {
                mockVarInfoChild
            }));

            DEBUG_PROPERTY_INFO propertyInfo;

            // Display both the pointer value and the value representation.
            GetPropertyInfo(
                enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE |
                enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE_AUTOEXPAND, out propertyInfo);

            Assert.That(propertyInfo.bstrValue, Is.EqualTo("0xDEADBEEF {1}"));

            // Display only the pointer.
            GetPropertyInfo(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE, out propertyInfo);
            Assert.That(propertyInfo.bstrValue, Is.EqualTo("0xDEADBEEF"));
        }
Exemplo n.º 3
0
        public void TestEnumChildren()
        {
            var children = new List <IVariableInformation>()
            {
                Substitute.For <IVariableInformation>(),
                Substitute.For <IVariableInformation>(),
                Substitute.For <IVariableInformation>()
            };

            mockVarInfo.MightHaveChildren().Returns(true);
            mockVarInfo.GetChildAdapter().Returns(new ListChildAdapter.Factory().Create(children));
            mockVarInfo.GetCachedView().Returns(mockVarInfo);
            var property = createPropertyDelegate.Invoke(mockVarInfo);

            IEnumDebugPropertyInfo2 propertyEnum;
            var guid   = new System.Guid();
            var result = property.EnumChildren(enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME, 10,
                                               ref guid,
                                               enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_ALL, "", 0,
                                               out propertyEnum);

            Assert.That(result, Is.EqualTo(VSConstants.S_OK));

            uint count;

            propertyEnum.GetCount(out count);
            Assert.That(count, Is.EqualTo(children.Count));
        }
Exemplo n.º 4
0
        public void SetUp()
        {
            mockVarInfo = Substitute.For <IVariableInformation>();
            mockVarInfo.GetCachedView().Returns(mockVarInfo);

            var taskExecutor = new TaskExecutor(new JoinableTaskContext().Factory);
            var enumFactory  = new VariableInformationEnum.Factory(taskExecutor);

            var childrenProviderFactory = new ChildrenProvider.Factory();

            propertyFactory =
                new DebugAsyncProperty.Factory(enumFactory, childrenProviderFactory, null,
                                               new VsExpressionCreator(), taskExecutor);

            createPropertyDelegate = propertyFactory.Create;

            childrenProviderFactory.Initialize(createPropertyDelegate);

            debugProperty = propertyFactory.Create(mockVarInfo);

            logSpy = new LogSpy();
            logSpy.Attach();
        }