コード例 #1
0
ファイル: DotnetSignTests.cs プロジェクト: NuGet/NuGet.Client
        public async Task DotnetSign_SignPackageWithTimestamping_SucceedsAsync()
        {
            // Arrange
            using (SimpleTestPathContext pathContext = _msbuildFixture.CreateSimpleTestPathContext())
            {
                await SimpleTestPackageUtility.CreatePackagesAsync(
                    pathContext.PackageSource,
                    new SimpleTestPackageContext("PackageA", "1.0.0"));

                string           packageFilePath  = Path.Combine(pathContext.PackageSource, "PackageA.1.0.0.nupkg");
                TimestampService timestampService = await _signFixture.GetDefaultTrustedTimestampServiceAsync();

                IX509StoreCertificate storeCertificate = _signFixture.DefaultCertificate;

                // Act
                CommandRunnerResult result = _msbuildFixture.RunDotnet(
                    pathContext.PackageSource,
                    GetDefaultArgs(packageFilePath, storeCertificate) +
                    $" --timestamper {timestampService.Url.OriginalString}",
                    ignoreExitCode: true);

                // Assert
                result.Success.Should().BeTrue(because: result.AllOutput);
                result.AllOutput.Should().NotContain(_noTimestamperWarningCode);
            }
        }