public void FactoryThrowsIfCreatePropertyDelegateIsNull()
 {
     _childrenProviderFactory.Initialize(null);
     Assert.Throws <NullReferenceException>(() => _childrenProviderFactory.Create(
                                                new ListChildAdapter.Factory().Create(
                                                    _children), _nameFlag, 0));
 }
Exemple #2
0
        public void SetUp()
        {
            lineEntry                  = new LineEntryInfo();
            mockDocumentContext        = Substitute.For <IDebugDocumentContext2>();
            mockThread                 = Substitute.For <IDebugThread>();
            mockDocumentContextFactory = Substitute.For <DebugDocumentContext.Factory>();
            mockDocumentContextFactory.Create(lineEntry).Returns(mockDocumentContext);
            mockDebuggerStackFrame = Substitute.For <RemoteFrame>();
            mockDebuggerStackFrame.GetLineEntry().Returns(lineEntry);
            mockDebuggerStackFrame.GetPC().Returns(TEST_PC);
            mockDebuggerStackFrame.GetFunctionName().Returns(NAME);
            mockDebuggerStackFrame.GetFunctionNameWithSignature().Returns(NAME);

            mockCodeContextFactory = Substitute.For <DebugCodeContext.Factory>();
            mockExpressionFactory  = Substitute.For <DebugExpression.Factory>();
            mockModuleCache        = Substitute.For <IDebugModuleCache>();

            mockDebugEngineHandler = Substitute.For <IDebugEngineHandler>();
            mockProgram            = Substitute.For <IGgpDebugProgram>();

            taskExecutor = new TaskExecutor(new JoinableTaskContext().Factory);

            var childAdapterFactory     = new RemoteValueChildAdapter.Factory();
            var varInfoFactory          = new LLDBVariableInformationFactory(childAdapterFactory);
            var varInfoEnumFactory      = new VariableInformationEnum.Factory(taskExecutor);
            var childrenProviderFactory = new ChildrenProvider.Factory();
            var propertyFactory         =
                new DebugProperty.Factory(varInfoEnumFactory, childrenProviderFactory,
                                          Substitute.For <DebugCodeContext.Factory>(),
                                          new VsExpressionCreator(), taskExecutor);

            childrenProviderFactory.Initialize(propertyFactory.Create);
            var registerSetsBuilderFactory = new RegisterSetsBuilder.Factory(varInfoFactory);

            stackFrame = new DebugStackFrame.Factory(mockDocumentContextFactory,
                                                     childrenProviderFactory, mockCodeContextFactory, mockExpressionFactory.Create,
                                                     varInfoFactory, varInfoEnumFactory, registerSetsBuilderFactory, taskExecutor)
                         .Create(new AD7FrameInfoCreator(mockModuleCache), mockDebuggerStackFrame,
                                 mockThread, mockDebugEngineHandler, mockProgram);

            stackFrameAsync = new DebugStackFrameAsync.Factory(mockDocumentContextFactory,
                                                               childrenProviderFactory, mockCodeContextFactory, mockExpressionFactory.Create,
                                                               varInfoFactory, varInfoEnumFactory, registerSetsBuilderFactory, taskExecutor)
                              .Create(new AD7FrameInfoCreator(mockModuleCache), mockDebuggerStackFrame,
                                      mockThread, mockDebugEngineHandler, mockProgram);
        }
Exemple #3
0
        public void SetUp()
        {
            _mockDebuggerStackFrame = Substitute.For <RemoteFrame>();
            var childAdapterFactory = new RemoteValueChildAdapter.Factory();
            var varInfoFactory      = new LLDBVariableInformationFactory(childAdapterFactory);

            _vsExpressionCreator = new VsExpressionCreator();

            _metrics = Substitute.For <IMetrics>();
            var eventScheduler        = new EventSchedulerFake();
            var eventSchedulerFactory = Substitute.For <IEventSchedulerFactory>();

            eventSchedulerFactory.Create(Arg.Do <System.Action>(a => eventScheduler.Callback = a))
            .Returns(eventScheduler);
            var       timer = new TimerFake();
            const int minimumBatchSeparationMilliseconds = 1;
            var       batchEventAggregator =
                new BatchEventAggregator <ExpressionEvaluationBatch, ExpressionEvaluationBatchParams,
                                          ExpressionEvaluationBatchSummary>(minimumBatchSeparationMilliseconds,
                                                                            eventSchedulerFactory, timer);

            _expressionEvaluationRecorder =
                new ExpressionEvaluationRecorder(batchEventAggregator, _metrics);
            _timeSource = new MonotonicTimeSource();

            _taskExecutor = Substitute.ForPartsOf <FakeTaskExecutor>();

            var enumFactory = new VariableInformationEnum.Factory(_taskExecutor);

            var childrenProviderFactory = new ChildrenProvider.Factory();
            var debugPropertyFactory    = new DebugProperty.Factory(
                enumFactory, childrenProviderFactory, null, _vsExpressionCreator, _taskExecutor);

            _createPropertyDelegate = debugPropertyFactory.Create;

            childrenProviderFactory.Initialize(_createPropertyDelegate);

            _varInfoBuilder = new VarInfoBuilder(varInfoFactory);
            varInfoFactory.SetVarInfoBuilder(_varInfoBuilder);

            _engineCommandsMock = Substitute.For <IDebugEngineCommands>();

            _mockDebugEngineHandler = Substitute.For <IDebugEngineHandler>();
            _mockProgram            = Substitute.For <IGgpDebugProgram>();
            _mockThread             = Substitute.For <IDebugThread2>();
        }
        public void SetUp()
        {
            FillThreeChildren();

            _childrenProviderFactory = new ChildrenProvider.Factory();

            var taskExecutor    = new TaskExecutor(new JoinableTaskContext().Factory);
            var enumFactory     = new VariableInformationEnum.Factory(taskExecutor);
            var propertyFactory = new DebugProperty.Factory(
                enumFactory, _childrenProviderFactory, Substitute.For <DebugCodeContext.Factory>(),
                new VsExpressionCreator(), taskExecutor);

            _childrenProviderFactory.Initialize(propertyFactory.Create);

            _childrenProvider =
                _childrenProviderFactory.Create(new ListChildAdapter.Factory().Create(_children),
                                                _nameFlag, 0);
        }
        public void SetUp()
        {
            mockVarInfo            = Substitute.For <IVariableInformation>();
            mockCodeContextFactory = Substitute.For <DebugCodeContext.Factory>();

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

            var childrenProviderFactory = new ChildrenProvider.Factory();
            var debugPropertyFactory    = new DebugAsyncProperty.Factory(
                enumFactory, childrenProviderFactory, mockCodeContextFactory,
                new VsExpressionCreator(), taskExecutor);

            createPropertyDelegate = debugPropertyFactory.Create;

            childrenProviderFactory.Initialize(createPropertyDelegate);

            logSpy = new LogSpy();
            logSpy.Attach();
        }
Exemple #6
0
        public void SetUp()
        {
            _children = new List <IVariableInformation>();

            var child1 = Substitute.For <IVariableInformation>();

            child1.DisplayName.Returns("child1");
            child1.GetCachedView().Returns(child1);
            _children.Add(child1);

            var child2 = Substitute.For <IVariableInformation>();

            child2.DisplayName.Returns("child2");
            child2.GetCachedView().Returns(child2);
            _children.Add(child2);

            var child3 = Substitute.For <IVariableInformation>();

            child3.DisplayName.Returns("child3");
            child3.GetCachedView().Returns(child3);
            _children.Add(child3);

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

            _enumFactory = new VariableInformationEnum.Factory(taskExecutor);

            _childrenProviderFactory = new ChildrenProvider.Factory();
            var propertyFactory = new DebugProperty.Factory(
                _enumFactory, _childrenProviderFactory, Substitute.For <DebugCodeContext.Factory>(),
                new VsExpressionCreator(), taskExecutor);

            _childrenProviderFactory.Initialize(propertyFactory.Create);

            var childrenProvider = _childrenProviderFactory.Create(
                new ListChildAdapter.Factory().Create(_children),
                enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME, 0);

            _varInfoEnum = _enumFactory.Create(childrenProvider);
        }