Example #1
0
        /// <summary>
        /// Executes package restore and builds the test solution.
        /// </summary>
        /// <param name="scenarioName">The name of the scenario to build. If omitted, it will be the name of the calling method.</param>
        /// <param name="projectName">The leaf name of the project to be built or rebuilt.</param>
        /// <param name="properties">Build properties to pass to MSBuild.</param>
        /// <returns>A collection of the built packages.</returns>
        public static async Task <IReadOnlyCollection <IPackage> > RestoreAndBuildPackagesAsync([CallerMemberName] string scenarioName = null, string projectName = null, IDictionary <string, string> properties = null, ITestOutputHelper testLogger = null)
        {
            var projectFullPath = Assets.GetScenarioSolutionPath(scenarioName);

            var projectDirectory = Path.GetDirectoryName(projectFullPath);
            await NuGetHelper.RestorePackagesAsync(projectDirectory);

            var result = await MSBuild.RebuildAsync(projectFullPath, projectName, properties, testLogger);

            result.AssertSuccessfulBuild();

            return(NuPkg.GetPackages(projectDirectory));
        }
Example #2
0
        /// <summary>
        /// Asserts that a NuPkg archive contains a file with the specified relative path.
        /// </summary>
        /// <param name="nupkgPath">The path to the zip archive.</param>
        /// <param name="packedFile">The path to the file that should exist in the archive. Case sensitive.</param>
        public static void PackageContains(string nupkgPath, string packedFile)
        {
            var package = NuPkg.GetPackage(nupkgPath);

            Assert.NotNull(package.GetFile(packedFile));
        }