示例#1
0
        public async Task CheckAllFiles(string filename1, string filename2)
        {
            SharedOmniSharpTestHost.ClearWorkspace();

            var testFile1 = new TestFile(filename1, "class C1 { int n = true; }");
            var testFile2 = new TestFile(filename2, "class C2 { int n = true; }");

            SharedOmniSharpTestHost.AddFilesToWorkspace(testFile1, testFile2);
            var emitter   = new DiagnosticTestEmitter();
            var forwarder = new DiagnosticEventForwarder(emitter);
            var service   = CreateDiagnosticService(forwarder);

            var controller = new DiagnosticsService(forwarder, service);
            var response   = await controller.Handle(new DiagnosticsRequest());

            await emitter.ExpectForEmitted(msg => msg.Results
                                           .Any(r => r.FileName == filename1 && r.QuickFixes.Count() == 1));

            await emitter.ExpectForEmitted(msg => msg.Results
                                           .Any(r => r.FileName == filename2 && r.QuickFixes.Count() == 1));
        }
示例#2
0
        public async Task CodeCheckSpecifiedFileOnly(string filename)
        {
            SharedOmniSharpTestHost.ClearWorkspace();

            var testFile = new TestFile(filename, "class C { int n = true; }");

            var emitter   = new DiagnosticTestEmitter();
            var forwarder = new DiagnosticEventForwarder(emitter)
            {
                IsEnabled = true
            };

            var service = CreateDiagnosticService(forwarder);

            SharedOmniSharpTestHost.AddFilesToWorkspace(testFile);

            var controller = new DiagnosticsService(forwarder, service);
            var response   = await controller.Handle(new DiagnosticsRequest { FileName = testFile.FileName });

            await emitter.ExpectForEmitted(msg => msg.Results.Any(m => m.FileName == filename));
        }