public void ActivatePlugins_PluginRuleViolations_ShouldCallReporter() { // arrange var filePath1 = TestHelper.GetTestFilePath(@"c:\pluginDirectory\plugin_one.dll"); var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData> { { filePath1, new MockFileData(string.Empty) } }); var assemblyWrapper = new TestAssemblyWrapper(); var pluginPaths = new Dictionary <string, string> { { "my-plugin", filePath1 } }; var reporter = Substitute.For <IReporter>(); var textReader = ParsingUtility.CreateTextReaderFromString("\tSELECT * FROM FOO"); var scriptPath = TestHelper.GetTestFilePath(@"c:\scripts\foo.sql"); var context = new PluginContext(scriptPath, new List <IRuleException>(), textReader); var versionWrapper = Substitute.For <IFileversionWrapper>(); versionWrapper.GetVersion(Arg.Any <Assembly>()).Returns("1.2.3"); // act var pluginHandler = new Infrastructure.Plugins.PluginHandler(reporter, fileSystem, assemblyWrapper, versionWrapper); pluginHandler.ProcessPaths(pluginPaths); // assert Assert.AreEqual(1, pluginHandler.Plugins.Count); Assert.DoesNotThrow(() => pluginHandler.ActivatePlugins(context)); reporter.Received().ReportViolation(Arg.Is <IRuleViolation>(x => x.FileName == context.FilePath && x.RuleName == "prefer-tabs" && x.Text == "Should use spaces rather than tabs" && x.Line == 1 && x.Column == 0 && x.Severity == RuleViolationSeverity.Warning)); }