public void DiagnosticTriggeredMultipleRethrows()
        {
            var actual = CodeSampleProvider.GetBeforeCode();

            var expected = new[]
            {
                new DiagnosticResult
                {
                    Id        = RethrowAndKeepStackTraceAnalyzer.DiagnosticId,
                    Message   = "Exception 'ex' is rethrown with an explicit reference to the exception object.",
                    Severity  = DiagnosticSeverity.Warning,
                    Locations = new[] { new DiagnosticResultLocation("Test0.cs", 23, 27) }
                },
                new DiagnosticResult
                {
                    Id        = RethrowAndKeepStackTraceAnalyzer.DiagnosticId,
                    Message   = "Exception 'ex' is rethrown with an explicit reference to the exception object.",
                    Severity  = DiagnosticSeverity.Warning,
                    Locations = new[] { new DiagnosticResultLocation("Test0.cs", 33, 23) }
                }
            };

            this.VerifyDiagnostic(actual, expected);

            var afterTheFix = CodeSampleProvider.GetAfterCode();

            this.VerifyFix(actual, afterTheFix);
        }
        public void DiagnosticTriggered2()
        {
            var actual = CodeSampleProvider.GetBeforeCode();

            var expected = new DiagnosticResult
            {
                Id        = ExceptionShouldHaveExceptionInTheirNameAnalyzer.DiagnosticId,
                Message   = string.Format("Exception name 'HoustonWeHaveAProblem' should contain the word \"Exception\".", "ex"),
                Severity  = DiagnosticSeverity.Warning,
                Locations = new[]
                {
                    new DiagnosticResultLocation("Test0.cs", 5, 18)
                }
            };

            this.VerifyDiagnostic(actual, expected);

            var afterTheFix = CodeSampleProvider.GetAfterCode();

            this.VerifyFix(actual, afterTheFix, 1);
        }
        public void NotAnException()
        {
            var before = CodeSampleProvider.GetBeforeCode();

            this.VerifyDiagnostic(before);
        }
        public void ExceptionNameIsCorrect()
        {
            var before = CodeSampleProvider.GetBeforeCode();

            this.VerifyDiagnostic(before);
        }
        public void NewExceptionOfDifferentType()
        {
            var before = CodeSampleProvider.GetBeforeCode();

            this.VerifyDiagnostic(before);
        }
        public void ExceptionRethrownRetainingTheStackTrace()
        {
            var before = CodeSampleProvider.GetBeforeCode();

            this.VerifyDiagnostic(before);
        }
        public void NoExceptionIdDoesntTriggerAnalyzer()
        {
            var before = CodeSampleProvider.GetBeforeCode();

            this.VerifyDiagnostic(before);
        }