Beispiel #1
0
        /// <summary>
        /// Executes package restore and builds the test solution, asserting build failure.
        /// </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>
        public static async Task RestoreAndFailBuildAsync([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.AssertUnsuccessfulBuild();
        }
Beispiel #2
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)
        {
            var projectFullPath = Assets.GetScenarioSolutionPath(scenarioName);

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

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

            result.AssertSuccessfulBuild();

            return(NuPkg.GetPackages(projectDirectory));
        }