Beispiel #1
0
        protected override void RunTest(string testAssemblyName, string appAsmVersion, string appFileVersion, bool appWins)
        {
            var component = SharedState.CreateComponentWithNoDependencies(b => b
                                                                          .WithPackage(TestVersionsPackage, "1.0.0", lib => lib
                                                                                       .WithAssemblyGroup(null, g => g
                                                                                                          .WithAsset(testAssemblyName + ".dll", rf => rf
                                                                                                                     .WithVersion(appAsmVersion, appFileVersion)))));

            // For component dependency resolution, frameworks are not considered, so the assembly from the component always wins
            string expectedTestAssemblyPath = Path.Combine(component.Location, testAssemblyName + ".dll");

            SharedState.RunComponentResolutionTest(component)
            .Should().Pass()
            .And.HaveSuccessfullyResolvedComponentDependencies()
            .And.HaveResolvedComponentDependencyAssembly($"{component.AppDll};{expectedTestAssemblyPath}");
        }
Beispiel #2
0
        protected override void RunTest(
            Action <NetCoreAppBuilder.RuntimeLibraryBuilder> assetsCustomizer,
            string rid,
            string includedAssemblyPaths,
            string excludedAssemblyPaths,
            string includedNativeLibraryPaths,
            string excludedNativeLibraryPaths,
            Action <NetCoreAppBuilder> appCustomizer)
        {
            var component = SharedState.CreateComponentWithNoDependencies(b => b
                                                                          .WithPackage("NativeDependency", "1.0.0", p => assetsCustomizer?.Invoke(p))
                                                                          .WithCustomizer(appCustomizer));

            SharedState.RunComponentResolutionTest(component.AppDll, ComponentSharedState.HostApp, ComponentSharedState.HostApp.Location, command => command
                                                   .RuntimeId(rid))
            .Should().Pass()
            .And.HaveSuccessfullyResolvedComponentDependencies()
            .And.HaveResolvedComponentDependencyAssembly(includedAssemblyPaths, component)
            .And.NotHaveResolvedComponentDependencyAssembly(excludedAssemblyPaths, component)
            .And.HaveResolvedComponentDependencyNativeLibraryPath(includedNativeLibraryPaths, component)
            .And.NotHaveResolvedComponentDependencyNativeLibraryPath(excludedNativeLibraryPaths, component);
        }
Beispiel #3
0
        protected override void RunTest(
            Action <NetCoreAppBuilder.RuntimeLibraryBuilder> assetsCustomizer,
            string rid,
            string includedAssemblyPaths,
            string excludedAssemblyPaths,
            string includedNativeLibraryPaths,
            string excludedNativeLibraryPaths,
            Action <NetCoreAppBuilder> appCustomizer)
        {
            var component = SharedState.CreateComponentWithNoDependencies(b => b
                                                                          .WithPackage("NativeDependency", "1.0.0", p => assetsCustomizer?.Invoke(p))
                                                                          .WithCustomizer(appCustomizer));

            string assemblyPaths = includedAssemblyPaths ?? "";

            if (excludedAssemblyPaths != null)
            {
                assemblyPaths = assemblyPaths.Length == 0 ? (";" + excludedAssemblyPaths) : excludedAssemblyPaths;
            }

            string nativeLibrarypaths = includedNativeLibraryPaths ?? "";

            if (excludedNativeLibraryPaths != null)
            {
                nativeLibrarypaths = nativeLibrarypaths.Length == 0 ? (";" + excludedNativeLibraryPaths) : excludedNativeLibraryPaths;
            }

            // Self-contained apps don't have any RID fallback graph, so currently there's no way to resolve native dependencies
            // from portable components - as we have no way of knowing how to follow RID fallback logic.
            SharedState.RunComponentResolutionTest(component.AppDll, ComponentSharedState.HostApp, ComponentSharedState.HostApp.Location, command => command
                                                   .RuntimeId(rid))
            .Should().Pass()
            .And.HaveSuccessfullyResolvedComponentDependencies()
            .And.NotHaveResolvedComponentDependencyAssembly(assemblyPaths, component)
            .And.NotHaveResolvedComponentDependencyNativeLibraryPath(nativeLibrarypaths, component);
        }