public async Task EnablesWhenEndPointIsHit(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 TestEventEmitter <DiagnosticMessage>();
            var forwarder = new DiagnosticEventForwarder(emitter);
            var service   = CreateDiagnosticService(forwarder);

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

            Assert.True(forwarder.IsEnabled);
        }
        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 TestEventEmitter <DiagnosticMessage>();
            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));
        }
        public async Task CodeCheckSpecifiedFileOnly(string filename)
        {
            SharedOmniSharpTestHost.ClearWorkspace();

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

            var emitter   = new TestEventEmitter <DiagnosticMessage>();
            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));
        }
 public FixAllFacts(ITestOutputHelper testOutput)
 {
     _testOutput            = testOutput;
     _analysisEventListener = new TestEventEmitter <ProjectDiagnosticStatusMessage>();
 }
 public ReAnalysisFacts(ITestOutputHelper testOutput)
 {
     _testOutput    = testOutput;
     _eventListener = new TestEventEmitter <BackgroundDiagnosticStatusMessage>();
 }