Exemple #1
0
        public void Write_Text_To_The_Screen()
        {
            var controlMock        = new Mock <IDebugControl6>();
            var clientMock         = new Mock <IDebugClient5>();
            var registersMock      = new Mock <IDebugRegisters2>();
            var systemObjectsMock  = new Mock <IDebugSystemObjects>();
            var dataSpacesMock     = new Mock <IDebugDataSpaces>();
            var executeWrapperMock = new Mock <IExecuteWrapper>();

            controlMock.Setup(control =>
                              control.ControlledOutput(DEBUG_OUTCTL.ALL_CLIENTS, DEBUG_OUTPUT.NORMAL, It.IsAny <string>()));

            const string Value = @"PEB at 00000041e9154000
    InheritedAddressSpace:    No
    ReadImageFileExecOptions: No
    BeingDebugged:            No";

            executeWrapperMock.Setup(wrapper => wrapper.Execute(It.IsAny <string>())).Returns(Value);

            var eng = new DebugEngineProxy(controlMock.Object, clientMock.Object, registersMock.Object,
                                           systemObjectsMock.Object,
                                           dataSpacesMock.Object, executeWrapperMock.Object);

            eng.WriteLine("hi");
            controlMock.Verify(control => control.ControlledOutput(DEBUG_OUTCTL.ALL_CLIENTS, DEBUG_OUTPUT.NORMAL, "hi\n"), Times.Once);
        }
        /// <summary>
        ///     Displays the specified object.
        /// </summary>
        /// <param name="obj">The object.</param>
        /// <inheritdoc />
        public void Display(object obj)
        {
            var json = JsonConvert.SerializeObject(obj, Formatting.Indented);

            DebugEngineProxy.WriteLine(json);
        }