public void DifferingMvids() { var directory = Temp.CreateDirectory(); // Load Beta.dll from the future Alpha.dll path to prime the assembly loader var alphaDll = directory .CreateFile("Alpha.dll") .WriteAllBytes(TestResources.AssemblyLoadTests.Beta); var assemblyLoader = new InMemoryAssemblyLoader(); var betaAssembly = assemblyLoader.LoadFromPath(alphaDll.Path); alphaDll.WriteAllBytes(TestResources.AssemblyLoadTests.Alpha); var gammaDll = directory .CreateFile("Gamma.dll") .WriteAllBytes(TestResources.AssemblyLoadTests.Gamma); var deltaDll = directory .CreateFile("Delta.dll") .WriteAllBytes(TestResources.AssemblyLoadTests.Delta); var analyzerReferences = ImmutableArray.Create( new CommandLineAnalyzerReference("Alpha.dll"), new CommandLineAnalyzerReference("Gamma.dll"), new CommandLineAnalyzerReference("Delta.dll") ); var result = AnalyzerConsistencyChecker.Check( directory.Path, analyzerReferences, assemblyLoader, Logger ); Assert.False(result); }
public void AllChecksPassed() { var directory = Temp.CreateDirectory(); var alphaDll = directory .CreateFile("Alpha.dll") .WriteAllBytes(TestResources.AssemblyLoadTests.Alpha); var betaDll = directory .CreateFile("Beta.dll") .WriteAllBytes(TestResources.AssemblyLoadTests.Beta); var gammaDll = directory .CreateFile("Gamma.dll") .WriteAllBytes(TestResources.AssemblyLoadTests.Gamma); var deltaDll = directory .CreateFile("Delta.dll") .WriteAllBytes(TestResources.AssemblyLoadTests.Delta); var analyzerReferences = ImmutableArray.Create( new CommandLineAnalyzerReference("Alpha.dll"), new CommandLineAnalyzerReference("Beta.dll"), new CommandLineAnalyzerReference("Gamma.dll"), new CommandLineAnalyzerReference("Delta.dll") ); var result = AnalyzerConsistencyChecker.Check( directory.Path, analyzerReferences, new InMemoryAssemblyLoader(), Logger ); Assert.True(result); }
public void NetstandardIgnored() { var directory = Temp.CreateDirectory(); const string name = "netstandardRef"; var comp = CSharpCompilation.Create( name, new[] { SyntaxFactory.ParseSyntaxTree(@"class C {}") }, references: new MetadataReference[] { MetadataReference.CreateFromImage( TestMetadata.ResourcesNetStandard20.netstandard ) }, options: new CSharpCompilationOptions( OutputKind.DynamicallyLinkedLibrary, warningLevel: Diagnostic.MaxWarningLevel ) ); var compFile = directory.CreateFile(name); comp.Emit(compFile.Path); var analyzerReferences = ImmutableArray.Create(new CommandLineAnalyzerReference(name)); var result = AnalyzerConsistencyChecker.Check( directory.Path, analyzerReferences, new InMemoryAssemblyLoader(), Logger ); Assert.True(result); }
public void MissingReference() { var directory = Temp.CreateDirectory(); var alphaDll = directory.CreateFile("Alpha.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Alpha); var analyzerReferences = ImmutableArray.Create(new CommandLineAnalyzerReference("Alpha.dll")); var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, new InMemoryAssemblyLoader()); Assert.False(result); }
public void MissingReference() { var directory = Temp.CreateDirectory(); var alphaDll = directory.CopyFile(TestFixture.Alpha.Path); var analyzerReferences = ImmutableArray.Create(new CommandLineAnalyzerReference("Alpha.dll")); var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, new InMemoryAssemblyLoader(), Logger); Assert.True(result); }
public void AssemblyLoadException() { var directory = Temp.CreateDirectory(); var deltaDll = directory.CreateFile("Delta.dll").WriteAllBytes(TestResources.AssemblyLoadTests.Delta); var analyzerReferences = ImmutableArray.Create( new CommandLineAnalyzerReference("Delta.dll")); var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, TestAnalyzerAssemblyLoader.LoadNotImplemented); Assert.False(result); }
public void AllChecksPassed() { var analyzerReferences = ImmutableArray.Create( new CommandLineAnalyzerReference("Alpha.dll"), new CommandLineAnalyzerReference("Beta.dll"), new CommandLineAnalyzerReference("Gamma.dll"), new CommandLineAnalyzerReference("Delta.dll")); var result = AnalyzerConsistencyChecker.Check(Path.GetDirectoryName(TestFixture.Alpha.Path), analyzerReferences, new InMemoryAssemblyLoader(), Logger); Assert.True(result); }
public void AssemblyLoadException() { var directory = Temp.CreateDirectory(); directory.CopyFile(TestFixture.Delta1.Path); var analyzerReferences = ImmutableArray.Create( new CommandLineAnalyzerReference("Delta.dll")); var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, TestAnalyzerAssemblyLoader.LoadNotImplemented, Logger); Assert.False(result); }
public void DifferingMvids() { var directory = Temp.CreateDirectory(); // Load Beta.dll from the future Alpha.dll path to prime the assembly loader var alphaDll = directory.CopyFile(TestFixture.Beta.Path, name: "Alpha.dll"); var assemblyLoader = new InMemoryAssemblyLoader(); var betaAssembly = assemblyLoader.LoadFromPath(alphaDll.Path); // now overwrite the {directory}/Alpha.dll file with the content from our Alpha.dll test resource alphaDll.CopyContentFrom(TestFixture.Alpha.Path); directory.CopyFile(TestFixture.Gamma.Path); directory.CopyFile(TestFixture.Delta1.Path); var analyzerReferences = ImmutableArray.Create( new CommandLineAnalyzerReference("Alpha.dll"), new CommandLineAnalyzerReference("Gamma.dll"), new CommandLineAnalyzerReference("Delta.dll")); var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, assemblyLoader, Logger); Assert.False(result); }