public void UnresolvedAssemblyTest()
        {
            var finder = new Microsoft.Fx.Portability.Analyzer.ReflectionMetadataDependencyFinder();
            var progressReport = Substitute.For<IProgressReporter>();

            var path = this.GetType().GetTypeInfo().Assembly.Location;
            var testInfo = new FileInfo(path);

            var dependencies = finder.FindDependencies(new[] { testInfo }, progressReport);
            var actual = dependencies.UnresolvedAssemblies
                            .Select(u => u.Key)
                            .OrderBy(u => u);

            _log.WriteLine("Actual unresolved assemblies:");
            foreach(var assembly in actual)
            {
                _log.WriteLine(assembly);
            }

            Assert.Equal(_expectedResult.Count(), actual.Count());

            // Use this instead of Assert.Equal so it will output the missing item
            foreach (var items in _expectedResult.Zip(actual, Tuple.Create))
            {
                Assert.Equal(items.Item1, items.Item2);
            }

            Assert.True(dependencies.UnresolvedAssemblies.All(o => o.Value.Count == 1));
            Assert.True(dependencies.UnresolvedAssemblies.All(o => string.Equals(o.Value.First(), "Microsoft.Fx.Portability.MetadataReader.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4a286c3e845c3e69", StringComparison.Ordinal)));

            // Make sure no issues were found
            progressReport.Received(0).ReportIssue(Arg.Any<string>());
        }
Esempio n. 2
0
        public void UnresolvedAssemblyTest()
        {
            var finder         = new Microsoft.Fx.Portability.Analyzer.ReflectionMetadataDependencyFinder();
            var progressReport = Substitute.For <IProgressReporter>();

            var path     = this.GetType().GetTypeInfo().Assembly.Location;
            var testInfo = new FileInfo(path);

            var dependencies = finder.FindDependencies(new[] { testInfo }, progressReport);
            var actual       = dependencies.UnresolvedAssemblies
                               .Select(u => u.Key)
                               .OrderBy(u => u);

            _log.WriteLine("Actual unresolved assemblies:");
            foreach (var assembly in actual)
            {
                _log.WriteLine(assembly);
            }

            Assert.Equal(_expectedResult.Count(), actual.Count());

            // Use this instead of Assert.Equal so it will output the missing item
            foreach (var items in _expectedResult.Zip(actual, Tuple.Create))
            {
                Assert.Equal(items.Item1, items.Item2);
            }

            Assert.True(dependencies.UnresolvedAssemblies.All(o => o.Value.Count == 1));
            Assert.True(dependencies.UnresolvedAssemblies.All(o => string.Equals(o.Value.First(), "Microsoft.Fx.Portability.MetadataReader.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4a286c3e845c3e69", StringComparison.Ordinal)));

            // Make sure no issues were found
            progressReport.Received(0).ReportIssue(Arg.Any <string>());
        }
Esempio n. 3
0
        public void UnresolvedAssemblyTest()
        {
            var finder         = new Microsoft.Fx.Portability.Analyzer.ReflectionMetadataDependencyFinder();
            var progressReport = Substitute.For <IProgressReporter>();
            var path           = new FileInfo("Microsoft.Fx.Portability.MetadataReader.Tests.dll");

            var dependencies = finder.FindDependencies(new[] { path }, progressReport);
            var actual       = dependencies.UnresolvedAssemblies
                               .Select(u => u.Key)
                               .OrderBy(u => u);

            Assert.Equal(_expectedResult, actual);
            Assert.True(dependencies.UnresolvedAssemblies.All(o => o.Value.Count == 1));
            Assert.True(dependencies.UnresolvedAssemblies.All(o => string.Equals(o.Value.First(), "Microsoft.Fx.Portability.MetadataReader.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", StringComparison.Ordinal)));

            // Make sure no issues were found
            progressReport.Received(0).ReportIssue(Arg.Any <string>());
        }