From ee79ceb687c9ced22d29cbd4f8423682a0196f23 Mon Sep 17 00:00:00 2001 From: Kartheek Penagamuri <52756182+kartheekp-ms@users.noreply.github.com> Date: Thu, 5 Mar 2020 11:16:39 -0800 Subject: [PATCH] addressing feedback --- .../GenerateSignedPackages.cs | 4 +++- .../VerifySignedPackages.cs | 2 +- test/TestUtilities/Test.Utility/Signing/TestPackages.cs | 6 ------ test/TestUtilities/Test.Utility/TestFileSystemUtility.cs | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/test/NuGet.Core.FuncTests/NuGet.Packaging.CrossVerify.Generate.Test/GenerateSignedPackages.cs b/test/NuGet.Core.FuncTests/NuGet.Packaging.CrossVerify.Generate.Test/GenerateSignedPackages.cs index 910ed34b48b..84972802485 100644 --- a/test/NuGet.Core.FuncTests/NuGet.Packaging.CrossVerify.Generate.Test/GenerateSignedPackages.cs +++ b/test/NuGet.Core.FuncTests/NuGet.Packaging.CrossVerify.Generate.Test/GenerateSignedPackages.cs @@ -16,7 +16,7 @@ namespace NuGet.Packaging.CrossVerify.Generate.Test public class GenerateSignedPackages { private readonly GenerateFixture _generateFixture; - private string _directoryPath; + private readonly string _directoryPath; private readonly SigningTestFixture _signingTestFixture_Author; private readonly TrustedTestCert _authorSignningCert; @@ -396,6 +396,8 @@ public async Task PreGenerateSignedPackages_AuthorSigned_TimeStampedWithNoSignin nupkg, packagePath, timestampService.Url); + + Assert.True(File.Exists(signedPackagePath)); } } } diff --git a/test/NuGet.Core.FuncTests/NuGet.Packaging.CrossVerify.Verify.Test/VerifySignedPackages.cs b/test/NuGet.Core.FuncTests/NuGet.Packaging.CrossVerify.Verify.Test/VerifySignedPackages.cs index 5df558f4906..0b4a8310ec0 100644 --- a/test/NuGet.Core.FuncTests/NuGet.Packaging.CrossVerify.Verify.Test/VerifySignedPackages.cs +++ b/test/NuGet.Core.FuncTests/NuGet.Packaging.CrossVerify.Verify.Test/VerifySignedPackages.cs @@ -358,7 +358,7 @@ public async Task VerifySignaturesAsync_PreGenerateSignedPackages_AuthorSigned_T string caseName = TestPackages.Package1.ToString(); var signedPackageFolder = Path.Combine(dir, caseName, "package"); - var signedPackagePath = TestFileSystemUtility.GetFirstFileName(signedPackageFolder, "*.nupkg"); + var signedPackagePath = TestFileSystemUtility.GetFirstFileNameOrNull(signedPackageFolder, "*.nupkg"); using (FileStream stream = File.OpenRead(signedPackagePath)) using (var reader = new PackageArchiveReader(stream)) diff --git a/test/TestUtilities/Test.Utility/Signing/TestPackages.cs b/test/TestUtilities/Test.Utility/Signing/TestPackages.cs index faea521e811..dd15464638c 100644 --- a/test/TestUtilities/Test.Utility/Signing/TestPackages.cs +++ b/test/TestUtilities/Test.Utility/Signing/TestPackages.cs @@ -1,12 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace Test.Utility.Signing { /// diff --git a/test/TestUtilities/Test.Utility/TestFileSystemUtility.cs b/test/TestUtilities/Test.Utility/TestFileSystemUtility.cs index 3dba9f8f0c7..d2857a0615d 100644 --- a/test/TestUtilities/Test.Utility/TestFileSystemUtility.cs +++ b/test/TestUtilities/Test.Utility/TestFileSystemUtility.cs @@ -95,7 +95,7 @@ private static DirectoryInfo GetRepositoryRoot(DirectoryInfo currentDir) /// /// /// - public static string GetFirstFileName(string path, string searchPattern) + public static string GetFirstFileNameOrNull(string path, string searchPattern) { IEnumerable files = Directory.EnumerateFiles(path, searchPattern);