// // Copyright (c) StellaOps. Licensed under the BUSL-1.1. // using StellaOps.Spdx3.Model; namespace StellaOps.Spdx3.Tests; [Trait("Category", "Unit")] [Trait("Intent", "Operational")] public sealed class ModelExternalIdentifierTests { [Fact] public void ExternalIdentifierExtensions_GetPurl_Works() { var identifiers = new[] { new Spdx3ExternalIdentifier { ExternalIdentifierType = Spdx3ExternalIdentifierType.PackageUrl, Identifier = "pkg:npm/lodash@4.17.21" }, new Spdx3ExternalIdentifier { ExternalIdentifierType = Spdx3ExternalIdentifierType.Cpe23, Identifier = "cpe:2.3:a:lodash:lodash:4.17.21:*:*:*:*:*:*:*" } }; Assert.Equal("pkg:npm/lodash@4.17.21", identifiers.GetPurl()); Assert.Equal("cpe:2.3:a:lodash:lodash:4.17.21:*:*:*:*:*:*:*", identifiers.GetCpe23()); } }