public void DebuggerAttacherService_AttacherReturnsFalse_AnswerWithoutReason()
 {
     MockDebuggerAttacher
     .Setup(a => a.AttachDebugger(It.IsAny <int>()))
     .Returns(MessageBasedDebuggerAttacherTests.GetAttachDebuggerAction(() => false));
     DoTest("unknown reasons");
 }
 public void DebuggerAttacherService_AttacherThrows_AnswerIncludesExceptionMessage()
 {
     MockDebuggerAttacher
     .Setup(a => a.AttachDebugger(It.IsAny <int>()))
     .Returns(MessageBasedDebuggerAttacherTests.GetAttachDebuggerAction(() => { throw new Exception("my message"); }));
     DoTest("my message");
 }
 public void DebuggerAttacherService_ReceivesMessage_AnswersImmediately()
 {
     MockDebuggerAttacher
     .Setup(a => a.AttachDebugger(It.IsAny <int>()))
     .Returns(MessageBasedDebuggerAttacherTests.GetAttachDebuggerAction(() => true));
     DoTest(null);
 }
示例#4
0
        public void AttachDebugger_AttachingThrows_ErrorOutputGenerated()
        {
            MockDebuggerAttacher
            .Setup(a => a.AttachDebugger(It.IsAny <int>(), It.IsAny <DebuggerEngine>()))
            .Returns(GetAttachDebuggerAction(() => { throw new Exception("my message"); }));

            DoTest(false);

            MockLogger.Verify(l => l.LogError(It.Is <string>(s => s.Contains("my message"))), Times.Once);
        }
示例#5
0
        public void AttachDebugger_AttachingFails_ErrorOutputGenerated()
        {
            MockDebuggerAttacher
            .Setup(a => a.AttachDebugger(It.IsAny <int>(), It.IsAny <DebuggerEngine>()))
            .Returns(GetAttachDebuggerAction(() => false));

            DoTest(false);

            MockLogger.Verify(l => l.LogError(It.Is <string>(s => s.Contains("unknown reasons"))), Times.Once);
        }
示例#6
0
        public void AttachDebugger_AttachingSucceeds_DebugOutputGenerated()
        {
            MockDebuggerAttacher
            .Setup(a => a.AttachDebugger(It.IsAny <int>(), It.IsAny <DebuggerEngine>()))
            .Returns(GetAttachDebuggerAction(() => true));

            DoTest(true);

            MockLogger.Verify(l => l.DebugInfo(It.IsAny <string>()), Times.Exactly(1));
            MockLogger.Verify(l => l.DebugInfo(It.Is <string>(s => s.ToLower().Contains("attached"))));
        }