Beispiel #1
0
            public void TestDiagnosticNoErrors()
            {
                var errors = new List <FakeElementObject>();
                IDiagnosticsProvider diagnosticsService = new DiagnosticsProvider(new FileRepository(new PhysicalFile()));

                var diagnostics = diagnosticsService.ConvertToLSPDiagnostics(errors);

                Assert.AreEqual(0, diagnostics.Count);
            }
Beispiel #2
0
            public void TestDiagnosticOneError()
            {
                var errors = new List <FakeElementObject>();
                var info   = new FakeElementObject(token, "Msg");

                errors.Add(info);

                IDiagnosticsProvider diagnosticsService = new DiagnosticsProvider(new FileRepository(createFakeFile(token.filename, randomFakeSource)));

                var diagnostics = diagnosticsService.ConvertToLSPDiagnostics(errors);

                Assert.AreEqual(1, diagnostics.Count);
                Assert.AreEqual(token.filename, diagnostics[0].Source);
            }
Beispiel #3
0
            public void TestDiagnosticSubError()
            {
                var errors      = new List <FakeElementObject>();
                var errorObject = new FakeElementObject(token, "Msg");

                errorObject.AddAuxInfo(token, "SubMsg");
                errorObject.AddAuxInfo(token, "SubMsg2");
                errors.Add(errorObject);

                IDiagnosticsProvider diagnosticsService = new DiagnosticsProvider(new FileRepository(createFakeFile(token.filename, randomFakeSource)));

                var diagnostics = diagnosticsService.ConvertToLSPDiagnostics(errors);

                Assert.AreEqual(3, diagnostics.Count);
                Assert.IsNull(diagnostics.FirstOrDefault()?.RelatedInformation, "Related Diagnostic should be separate");
            }