Skip to content

Commit

Permalink
Implement new properties
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-meseldzija-sonarsource committed Jan 31, 2025
1 parent 0a3d3a2 commit ac9dd05
Show file tree
Hide file tree
Showing 5 changed files with 413 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,22 @@ internal class MockAnalyzerInstaller : IAnalyzerInstaller
public MockAnalyzerInstaller(IList<AnalyzerPlugin> analyzerPluginsToReturn = null) =>
AnalyzerPluginsToReturn = analyzerPluginsToReturn;

public void AssertExpectedPluginsRequested(IEnumerable<string> plugins)
public void AssertOnlyExpectedPluginsRequested(IEnumerable<Plugin> plugins)
{
SuppliedPlugins.Should().HaveSameCount(plugins);
foreach (var plugin in plugins)
{
AssertExpectedPluginRequested(plugin);
}
}

public void AssertExpectedPluginRequested(string key)
public void AssertExpectedPluginRequested(Plugin plugin)
{
SuppliedPlugins.Should().NotBeEmpty("No plugins have been requested");
var found = SuppliedPlugins.Any(x => string.Equals(key, x.Key, System.StringComparison.Ordinal));
found.Should().BeTrue("Expected plugin was not requested. Id: {0}", key);
var suppliedPlugin = SuppliedPlugins.FirstOrDefault(x => string.Equals(plugin.Key, x.Key, System.StringComparison.Ordinal));
suppliedPlugin.Should().NotBeNull("Expected plugin was not requested. Id: {0}", plugin.Key);
suppliedPlugin.Version.Should().Be(plugin.Version);
suppliedPlugin.StaticResourceName.Should().Be(plugin.StaticResourceName);
}

IEnumerable<AnalyzerPlugin> IAnalyzerInstaller.InstallAssemblies(IEnumerable<Plugin> plugins)
Expand Down
Loading

0 comments on commit ac9dd05

Please sign in to comment.