public async Task GetNuspecAsync_ReturnsReadableStream() { using (var test = PackageReaderTest.Create(TestPackagesCore.GetPackageCoreReaderTestPackage())) using (var stream = await test.Reader.GetNuspecAsync(CancellationToken.None)) { Assert.NotNull(stream); Assert.True(stream.CanRead); } }
public void GetNuspecFile_ReturnsNuspecPathInPackage() { using (var test = PackageReaderTest.Create(TestPackagesCore.GetPackageCoreReaderTestPackage())) { var filePath = test.Reader.GetNuspecFile(); Assert.Equal(Path.Combine(test.RootDirectoryPath, "Aa.nuspec"), filePath); } }
public async Task GetNuspecAsyncFile_ReturnsNuspecPathInPackage() { using (var test = PackageReaderTest.Create(TestPackagesCore.GetPackageCoreReaderTestPackage())) { var filePath = await test.Reader.GetNuspecFileAsync(CancellationToken.None); Assert.Equal(Path.Combine(test.RootDirectoryPath, "Aa.nuspec"), filePath); } }
public async Task GetNuspecReaderAsync_ReturnsNuspecReader() { using (var test = PackageReaderTest.Create(TestPackagesCore.GetPackageCoreReaderTestPackage())) { var nuspecReader = await test.Reader.GetNuspecReaderAsync(CancellationToken.None); Assert.NotNull(nuspecReader); } }
public void NuspecReader_ReturnsNuspecReader() { using (var test = PackageReaderTest.Create(TestPackagesCore.GetPackageCoreReaderTestPackage())) { var nuspecReader = test.Reader.NuspecReader; Assert.NotNull(nuspecReader); } }
public void GetNuspec_ReturnsReadableStream() { using (var test = PackageReaderTest.Create(TestPackagesCore.GetPackageCoreReaderTestPackage())) using (var stream = test.Reader.GetNuspec()) { Assert.NotNull(stream); Assert.True(stream.CanRead); } }
public void GetFiles_WithFolder_ReturnsFiles() { using (var test = PackageReaderTest.Create(TestPackagesCore.GetPackageCoreReaderTestPackage())) { var files = test.Reader.GetFiles("lib"); Assert.NotNull(files); Assert.Equal(2, files.Count()); } }
public async Task GetMinClientVersionAsync_ReturnsMinClientVersion() { using (var test = PackageReaderTest.Create(TestPackagesCore.GetPackageCoreReaderTestPackage())) { var version = await test.Reader.GetMinClientVersionAsync(CancellationToken.None); Assert.NotNull(version); Assert.Equal("1.2.3", version.ToNormalizedString()); } }
public async Task CopyNupkgAsync_Throws() { using (var test = PackageReaderTest.Create(TestPackagesCore.GetPackageCoreReaderTestPackage())) { await Assert.ThrowsAsync <NotImplementedException>( () => test.Reader.CopyNupkgAsync( nupkgFilePath: "a", cancellationToken: CancellationToken.None)); } }
public void GetMinClientVersion_ReturnsMinClientVersion() { using (var test = PackageReaderTest.Create(TestPackagesCore.GetPackageCoreReaderTestPackage())) { var version = test.Reader.GetMinClientVersion(); Assert.NotNull(version); Assert.Equal("1.2.3", version.ToNormalizedString()); } }
public async Task GetIdentityAsync_ReturnsPackageIdentity() { using (var test = PackageReaderTest.Create(TestPackagesCore.GetPackageCoreReaderTestPackage())) { var identity = await test.Reader.GetIdentityAsync(CancellationToken.None); Assert.NotNull(identity); Assert.Equal("Aa", identity.Id); Assert.Equal("4.5.6", identity.Version.ToNormalizedString()); } }
public void GetIdentity_ReturnsPackageIdentity() { using (var test = PackageReaderTest.Create(TestPackagesCore.GetPackageCoreReaderTestPackage())) { var identity = test.Reader.GetIdentity(); Assert.NotNull(identity); Assert.Equal("Aa", identity.Id); Assert.Equal("4.5.6", identity.Version.ToNormalizedString()); } }
public void GetPackageTypes_ReturnsPackageTypes() { using (var test = PackageReaderTest.Create(TestPackagesCore.GetPackageCoreReaderTestPackage())) { var packageTypes = test.Reader.GetPackageTypes(); Assert.NotEmpty(packageTypes); Assert.Equal(2, packageTypes.Count); Assert.Equal("Bb", packageTypes[0].Name); Assert.Equal("0.0", packageTypes[0].Version.ToString()); Assert.Equal("Cc", packageTypes[1].Name); Assert.Equal("7.8.9", packageTypes[1].Version.ToString()); } }
public async Task GetPackageTypesAsync_ReturnsPackageTypes() { using (var test = PackageReaderTest.Create(TestPackagesCore.GetPackageCoreReaderTestPackage())) { var packageTypes = await test.Reader.GetPackageTypesAsync(CancellationToken.None); Assert.NotEmpty(packageTypes); Assert.Equal(2, packageTypes.Count); Assert.Equal("Bb", packageTypes[0].Name); Assert.Equal("0.0", packageTypes[0].Version.ToString()); Assert.Equal("Cc", packageTypes[1].Name); Assert.Equal("7.8.9", packageTypes[1].Version.ToString()); } }
public async Task GetFilesAsync_WithFolder_ReturnsFiles() { using (var test = PackageReaderTest.Create(TestPackagesCore.GetPackageCoreReaderTestPackage())) { var files = (await test.Reader.GetFilesAsync("lib", CancellationToken.None)) .OrderBy(file => file) .ToArray(); Assert.NotNull(files); Assert.Equal(2, files.Length); Assert.Equal("lib/net45/a.dll", files[0]); Assert.Equal("lib/net45/b.dll", files[1]); } }
public async Task CopyFilesAsync_ReturnsCopiedFilePaths() { using (var testDirectory = TestDirectory.Create()) using (var test = PackageReaderTest.Create(TestPackagesCore.GetPackageCoreReaderTestPackage())) { var files = await test.Reader.CopyFilesAsync( testDirectory.Path, new[] { "Aa.nuspec" }, ExtractFile, NullLogger.Instance, CancellationToken.None); var expectedFilePath = Path.Combine(testDirectory.Path, "Aa.nuspec"); Assert.Equal(1, files.Count()); Assert.Equal(expectedFilePath, files.Single()); Assert.True(File.Exists(expectedFilePath)); } }
public void PathTooLongWarning_PackageWithOutLongPath_NoWarn() { using (var packageFile = TestPackagesCore.GetPackageCoreReaderTestPackage()) { var zip = TestPackagesCore.GetZip(packageFile); var ruleSet = RuleSet.PackageCreationRuleSet; using (var reader = new PackageArchiveReader(zip)) { var issues = new List <PackagingLogMessage>(); foreach (var rule in ruleSet) { issues.AddRange(rule.Validate(reader).OrderBy(p => p.Code.ToString(), StringComparer.CurrentCulture)); } Assert.False(issues.Any(p => p.Code == NuGetLogCode.NU5123)); } } }