Exemple #1
0
        public void ExtractDependencies(string targetFramework, string[] expected)
        {
            var dependenciesByTargetFramework = new Dictionary <string, NuGetPackageId[]>(StringComparer.OrdinalIgnoreCase)
            {
                {
                    NuGetSpecParser.NoGroupTargetFramework,
                    new[] { new NuGetPackageId("no group", "1.0") }
                },
                {
                    ".NETFramework2.0",
                    Array.Empty <NuGetPackageId>()
                },
                {
                    ".NETFramework4.5",
                    new[] { new NuGetPackageId("45", "1.0") }
                },
                {
                    NuGetSpecParser.FallbackGroupTargetFramework,
                    new[] { new NuGetPackageId("fallback group", "1.0") }
                },
            };

            var expectedIds = expected.Select(i => new NuGetPackageId(i, "1.0")).ToArray();
            var actual      = NuGetSpecParser.ExtractDependencies(dependenciesByTargetFramework, targetFramework).ToArray();

            actual.ShouldBe(expectedIds, true);
        }
Exemple #2
0
        public NuGetSpec ParseSpec(Stream content)
        {
            content.AssertNotNull(nameof(content));

            return(NuGetSpecParser.FromStream(content));
        }