示例#1
0
        public void FindsAssembliesInCandidates_Params_Multiples()
        {
            var resolver = new DefaultAssemblyCandidateFinder(
                new[]
            {
                typeof(DefaultAssemblyCandidateFinderTests).GetTypeInfo().Assembly,
                typeof(Class3).GetTypeInfo().Assembly
            },
                Logger
                );
            var items = resolver.GetCandidateAssemblies(
                new[] { "Rocket.Surgery.Conventions", "Rocket.Surgery.Conventions.Abstractions" }
                )
                        .Select(x => x.GetName().Name)
                        .ToArray();
            var items2 = resolver.GetCandidateAssemblies(
                "Rocket.Surgery.Conventions",
                "Rocket.Surgery.Conventions.Abstractions"
                )
                         .Select(x => x.GetName().Name)
                         .ToArray();

            foreach (var item in items)
            {
                Logger.LogInformation(item);
            }

            foreach (var item in items2)
            {
                Logger.LogInformation(item);
            }

            items
            .Should()
            .Contain(
                new[]
            {
                "Sample.DependencyOne",
                "Sample.DependencyThree",
                "Sample.DependencyTwo",
                "Rocket.Surgery.Conventions.Tests"
            }
                );
            items
            .Last()
            .Should()
            .Be("Rocket.Surgery.Conventions.Tests");
            items.Should().BeEquivalentTo(items2);
        }
示例#2
0
        public void FindsAssembliesInCandidates_Empty()
        {
            var resolver = new DefaultAssemblyCandidateFinder(
                new[] { typeof(DefaultAssemblyCandidateFinderTests).GetTypeInfo().Assembly },
                Logger
                );
            var items = resolver.GetCandidateAssemblies(Array.Empty <string>().AsEnumerable())
                        .Select(x => x.GetName().Name)
                        .ToArray();

            foreach (var item in items)
            {
                Logger.LogInformation(item);
            }

            items.Should().BeEmpty();
        }