示例#1
0
        public void non_dotnet_files_are_skipped()
        {
            var assemblyScanner = new AssemblyScanner(AssemblyScannerTests.GetTestAssemblyDirectory())
            {
                IncludeAppDomainAssemblies = false
            };

            var results = assemblyScanner
                          .GetScannableAssemblies();

            var skippedFiles = results.SkippedFiles;

            var notProperDotNetDlls = new[]
            {
                "libzmq-v120-mt-3_2_3.dll",
                "Tail.exe",
                "some_random.dll",
                "some_random.exe"
            };

            foreach (var notProperDll in notProperDotNetDlls)
            {
                var skippedFile = skippedFiles.FirstOrDefault(f => f.FilePath.Contains(notProperDll));

                if (skippedFile == null)
                {
                    throw new AssertionException($"Could not find skipped file matching {notProperDll}");
                }

                Assert.That(skippedFile.SkipReason, Contains.Substring("not a .NET assembly"));
            }
        }
示例#2
0
        public void roslyn_x86_image_type_correctly_detected()
        {
            var file = Path.Combine(AssemblyScannerTests.GetTestAssemblyDirectory(), "RoslynX86.dll");

            var compilationMode = Image.GetCompilationMode(file);

            Assert.That(compilationMode, Is.EqualTo(Image.CompilationMode.CLRx86));
        }
示例#3
0
        public void no_files_explicitly_excluded_are_returned()
        {
            var results = new AssemblyScanner(AssemblyScannerTests.GetTestAssemblyDirectory())
            {
                AssembliesToSkip = new List <string>
                {
                    "dotNet.dll"
                }
            }
            .GetScannableAssemblies();

            var skippedFiles         = results.SkippedFiles;
            var explicitlySkippedDll = skippedFiles.FirstOrDefault(s => s.FilePath.Contains("dotNet.dll"));

            Assert.That(explicitlySkippedDll, Is.Not.Null);
            Assert.That(explicitlySkippedDll.SkipReason, Contains.Substring("File was explicitly excluded from scanning"));
        }
        public void assemblies_without_nsb_reference_are_skipped()
        {
            var assemblyScanner = new AssemblyScanner(AssemblyScannerTests.GetTestAssemblyDirectory())
            {
                IncludeAppDomainAssemblies = false
            };

            var results = assemblyScanner
                          .GetScannableAssemblies();

            var skippedFiles = results.SkippedFiles;

            var skippedFile = skippedFiles.FirstOrDefault(f => f.FilePath.Contains("dotNet.dll"));

            if (skippedFile == null)
            {
                throw new AssertionException($"Could not find skipped file matching {"dotNet.dll"}");
            }
            Assert.That(skippedFile.SkipReason,
                        Contains.Substring("Assembly does not reference at least one of the must referenced assemblies"));
        }