public void HasServiceableFlagWhenArgumentPassed() { var testInstance = _testAssetsManager.CopyTestAsset("TestLibraryWithConfiguration") .WithSource(); var packCommand = new DotnetPackCommand(Log) .WithWorkingDirectory(testInstance.Path); var result = packCommand.Execute("-c", "Debug", "--serviceable"); result.Should().Pass(); var outputDir = new DirectoryInfo(Path.Combine(testInstance.Path, "bin", "Debug")); outputDir.Should().Exist() .And.HaveFile("TestLibraryWithConfiguration.1.0.0.nupkg"); var outputPackage = new FileInfo(Path.Combine(outputDir.FullName, "TestLibraryWithConfiguration.1.0.0.nupkg")); var zip = ZipFile.Open(outputPackage.FullName, ZipArchiveMode.Read); zip.Entries.Should().Contain(e => e.FullName == "TestLibraryWithConfiguration.nuspec"); var manifestReader = new StreamReader(zip.Entries.First(e => e.FullName == "TestLibraryWithConfiguration.nuspec").Open()); var nuspecXml = XDocument.Parse(manifestReader.ReadToEnd()); var node = nuspecXml.Descendants().Single(e => e.Name.LocalName == "serviceable"); Assert.Equal("true", node.Value); }
public void DotnetPackAcceptsRuntimeOption() { var testInstance = _testAssetsManager.CopyTestAsset("TestAppSimple") .WithSource(); var result = new DotnetPackCommand(Log) .WithWorkingDirectory(testInstance.Path) .Execute("--runtime", "unknown"); result.Should().Fail() .And.HaveStdOutContaining("NETSDK1083"); }
public void DotnetPackDoesNotPrintCopyrightInfo() { var testInstance = _testAssetsManager.CopyTestAsset("MSBuildTestApp") .WithSource(); var result = new DotnetPackCommand(Log) .WithWorkingDirectory(testInstance.Path) .Execute("--nologo"); result.Should().Pass(); if (!TestContext.IsLocalized()) { result.Should().NotHaveStdOutContaining("Copyright (C) Microsoft Corporation. All rights reserved."); } }
public void ItDoesNotImplicitlyBuildAProjectWhenPackagingWithTheNoBuildOption() { var testInstance = _testAssetsManager.CopyTestAsset("TestAppSimple") .WithSource(); var result = new DotnetPackCommand(Log) .WithWorkingDirectory(testInstance.Path) .Execute("--no-build"); result.Should().Fail(); if (!TestContext.IsLocalized()) { result.Should().NotHaveStdOutContaining("Restore") .And.HaveStdOutContaining("project.assets.json"); } }
public void OutputsPackagesFlatIntoOutputDirWhenOutputParameterIsPassed() { var testInstance = _testAssetsManager.CopyTestAsset("TestLibraryWithConfiguration") .WithSource(); var outputDir = new DirectoryInfo(Path.Combine(testInstance.Path, "bin2")); var packCommand = new DotnetPackCommand(Log) .WithWorkingDirectory(testInstance.Path) .Execute("-o", outputDir.FullName) .Should().Pass(); outputDir.Should().Exist() .And.HaveFiles(new [] { "TestLibraryWithConfiguration.1.0.0.nupkg" }); }