public void RefEntry()
        {
            var data   = @"
nuget_package(
    name = ""remotion.linq"",
    package = ""remotion.linq"",
    version = ""2.2.0"",
    core_ref = {
        ""netcoreapp2.0"": ""lib/netstandard1.0/Remotion.Linq.dll"",
        ""netcoreapp2.1"": ""lib/netstandard1.0/Remotion.Linq.dll"",
    },
    net_ref = {
        ""netcoreapp2.0"": ""lib/netstandard1.0/Remotion.Linq.dll"",
    },
    mono_ref = ""ref/net45/Newtonsoft.Json.dll"",
)
";
            var parser = new WorkspaceParser(data);
            var result = parser.Parse();

            Assert.Single(result);
            var entry = result.First();

            Assert.Equal("remotion.linq", entry.PackageIdentity.Id);
            Assert.Equal("2.2.0", entry.PackageIdentity.Version.ToString());
            Assert.Equal(2, entry.CoreRef.Count);
            Assert.Equal(1, entry.NetRef.Count);
            Assert.Equal("ref/net45/Newtonsoft.Json.dll", entry.MonoRef);
        }
        public void EmptyEntry()
        {
            var data   = @"
nuget_package(
    name = ""remotion.linq"",
    package = ""remotion.linq"",
    version = ""2.2.0"",
)
";
            var parser = new WorkspaceParser(data);
            var result = parser.Parse();

            Assert.Single(result);
            var entry = result.First();

            Assert.Equal("remotion.linq", entry.PackageIdentity.Id);
            Assert.Equal("2.2.0", entry.PackageIdentity.Version.ToString());
        }
        public void TestMethod1()
        {
            var toparse = @"
nuget_package(
    name = ""xunit"",
    package = ""xunit"",
    version = ""2.4.0"",
    sha256 = ""123456"",
    core_lib = ""lib/netstabdard2.0/Npgsql.dll"",
    net_lib = ""lib/net451/Npgsql.dll"",
    mono_lib = ""lib/net451/Npgsql.dll"",
    deps = [
    ],
    core_files = [
        ""lib/netstabdard2.0/Npgsql.xml"",
        ""ala.doc"",
    ],
    net_files = [
        ""lib/netstabdard2.0/Npgsql.xml"",
        ""ala.doc"",
    ],
    mono_files = [
        ""lib/netstabdard2.0/Npgsql.xml"",
        ""ala.doc"",
    ],
)
";

            var parser  = new WorkspaceParser(toparse);
            var entries = parser.Parse().ToList();

            Assert.AreEqual(1, entries.Count);

            var entry = entries.First();

            Assert.AreEqual("xunit", entry.PackageIdentity.Id);
            Assert.AreEqual("2.4.0", entry.PackageIdentity.Version.ToString());
            Assert.AreEqual("123456", entry.Sha256);
            Assert.AreEqual("lib/netstabdard2.0/Npgsql.dll", entry.CoreLib);
            Assert.AreEqual("lib/net451/Npgsql.dll", entry.NetLib);
            Assert.AreEqual("lib/net451/Npgsql.dll", entry.MonoLib);
        }
Beispiel #4
0
        public void SingleEntry()
        {
            var data    = @"
### Generated by the tool
nuget_package(
   name = ""remotion.linq"",
   package = ""remotion.linq"",
   version = ""2.2.0"",
)
### End of generated by the tool
";
            var writer  = new WorkspaceWriter();
            var section = writer.ExtractSection(data);

            var parser = new WorkspaceParser(section);
            var result = parser.Parse();

            Assert.Single(result);
            var entry = result.First();

            Assert.Equal("remotion.linq", entry.PackageIdentity.Id);
            Assert.Equal("2.2.0", entry.PackageIdentity.Version.ToString());
        }
        public void ComplexEntry()
        {
            var data   = @"
nuget_package(
    name = ""remotion.linq"",
    package = ""remotion.linq"",
    version = ""2.2.0"",
    core_lib = {
        ""netcoreapp2.0"": ""lib/netstandard1.0/Remotion.Linq.dll"",
        ""netcoreapp2.1"": ""lib/netstandard1.0/Remotion.Linq.dll"",
    },
)
";
            var parser = new WorkspaceParser(data);
            var result = parser.Parse();

            Assert.Single(result);
            var entry = result.First();

            Assert.Equal("remotion.linq", entry.PackageIdentity.Id);
            Assert.Equal("2.2.0", entry.PackageIdentity.Version.ToString());
            Assert.Equal(2, entry.CoreLib.Count);
        }
        public void FullEntry()
        {
            var data   = @"
nuget_package(
    name = ""newtonsoft.json"",
    core_files = {
        ""netcoreapp2.0"": [
            ""lib/netstandard2.0/Newtonsoft.Json.dll"",
            ""lib/netstandard2.0/Newtonsoft.Json.xml"",
        ],
        ""netcoreapp2.1"": [
            ""lib/netstandard2.0/Newtonsoft.Json.dll"",
            ""lib/netstandard2.0/Newtonsoft.Json.xml"",
        ],
    },
    core_lib = {
        ""netcoreapp2.0"": ""lib/netstandard2.0/Newtonsoft.Json.dll"",
        ""netcoreapp2.1"": ""lib/netstandard2.0/Newtonsoft.Json.dll"",
    },
    core_ref = {
        ""netcoreapp2.0"": ""ref/netstandard2.0/Newtonsoft.Json.dll"",
        ""netcoreapp2.1"": ""ref/netstandard2.0/Newtonsoft.Json.dll"",
    },
    mono_files = [
        ""lib/net45/Newtonsoft.Json.dll"",
        ""lib/net45/Newtonsoft.Json.xml"",
    ],
    mono_lib = ""lib/net45/Newtonsoft.Json.dll"",
    mono_ref = ""ref/net45/Newtonsoft.Json.dll"",
    net_files = {
        ""net45"": [
            ""lib/net45/Newtonsoft.Json.dll"",
            ""lib/net45/Newtonsoft.Json.xml"",
        ],
        ""net451"": [
            ""lib/net45/Newtonsoft.Json.dll"",
            ""lib/net45/Newtonsoft.Json.xml"",
        ],
        ""net452"": [
            ""lib/net45/Newtonsoft.Json.dll"",
            ""lib/net45/Newtonsoft.Json.xml"",
        ],
        ""net46"": [
            ""lib/net45/Newtonsoft.Json.dll"",
            ""lib/net45/Newtonsoft.Json.xml"",
        ],
        ""net461"": [
            ""lib/net45/Newtonsoft.Json.dll"",
            ""lib/net45/Newtonsoft.Json.xml"",
        ],
        ""net462"": [
            ""lib/net45/Newtonsoft.Json.dll"",
            ""lib/net45/Newtonsoft.Json.xml"",
        ],
        ""net47"": [
            ""lib/net45/Newtonsoft.Json.dll"",
            ""lib/net45/Newtonsoft.Json.xml"",
        ],
        ""net471"": [
            ""lib/net45/Newtonsoft.Json.dll"",
            ""lib/net45/Newtonsoft.Json.xml"",
        ],
        ""net472"": [
            ""lib/net45/Newtonsoft.Json.dll"",
            ""lib/net45/Newtonsoft.Json.xml"",
        ],
        ""netstandard1.0"": [
            ""lib/netstandard1.0/Newtonsoft.Json.dll"",
            ""lib/netstandard1.0/Newtonsoft.Json.xml"",
        ],
        ""netstandard1.1"": [
            ""lib/netstandard1.0/Newtonsoft.Json.dll"",
            ""lib/netstandard1.0/Newtonsoft.Json.xml"",
        ],
        ""netstandard1.2"": [
            ""lib/netstandard1.0/Newtonsoft.Json.dll"",
            ""lib/netstandard1.0/Newtonsoft.Json.xml"",
        ],
        ""netstandard1.3"": [
            ""lib/netstandard1.3/Newtonsoft.Json.dll"",
            ""lib/netstandard1.3/Newtonsoft.Json.xml"",
        ],
        ""netstandard1.4"": [
            ""lib/netstandard1.3/Newtonsoft.Json.dll"",
            ""lib/netstandard1.3/Newtonsoft.Json.xml"",
        ],
        ""netstandard1.5"": [
            ""lib/netstandard1.3/Newtonsoft.Json.dll"",
            ""lib/netstandard1.3/Newtonsoft.Json.xml"",
        ],
        ""netstandard1.6"": [
            ""lib/netstandard1.3/Newtonsoft.Json.dll"",
            ""lib/netstandard1.3/Newtonsoft.Json.xml"",
        ],
        ""netstandard2.0"": [
            ""lib/netstandard2.0/Newtonsoft.Json.dll"",
            ""lib/netstandard2.0/Newtonsoft.Json.xml"",
        ],
    },
    net_lib = {
        ""net45"": ""lib/net45/Newtonsoft.Json.dll"",
        ""net451"": ""lib/net45/Newtonsoft.Json.dll"",
        ""net452"": ""lib/net45/Newtonsoft.Json.dll"",
        ""net46"": ""lib/net45/Newtonsoft.Json.dll"",
        ""net461"": ""lib/net45/Newtonsoft.Json.dll"",
        ""net462"": ""lib/net45/Newtonsoft.Json.dll"",
        ""net47"": ""lib/net45/Newtonsoft.Json.dll"",
        ""net471"": ""lib/net45/Newtonsoft.Json.dll"",
        ""net472"": ""lib/net45/Newtonsoft.Json.dll"",
        ""netstandard1.0"": ""lib/netstandard1.0/Newtonsoft.Json.dll"",
        ""netstandard1.1"": ""lib/netstandard1.0/Newtonsoft.Json.dll"",
        ""netstandard1.2"": ""lib/netstandard1.0/Newtonsoft.Json.dll"",
        ""netstandard1.3"": ""lib/netstandard1.3/Newtonsoft.Json.dll"",
        ""netstandard1.4"": ""lib/netstandard1.3/Newtonsoft.Json.dll"",
        ""netstandard1.5"": ""lib/netstandard1.3/Newtonsoft.Json.dll"",
        ""netstandard1.6"": ""lib/netstandard1.3/Newtonsoft.Json.dll"",
        ""netstandard2.0"": ""lib/netstandard2.0/Newtonsoft.Json.dll"",
    },
    net_ref = {
        ""net45"": ""ref/net45/Newtonsoft.Json.dll"",
        ""net451"": ""ref/net45/Newtonsoft.Json.dll"",
        ""net452"": ""ref/net45/Newtonsoft.Json.dll"",
        ""net46"": ""ref/net45/Newtonsoft.Json.dll"",
        ""net461"": ""ref/net45/Newtonsoft.Json.dll"",
        ""net462"": ""ref/net45/Newtonsoft.Json.dll"",
        ""net47"": ""ref/net45/Newtonsoft.Json.dll"",
        ""net471"": ""ref/net45/Newtonsoft.Json.dll"",
        ""net472"": ""ref/net45/Newtonsoft.Json.dll"",
        ""netstandard1.0"": ""ref/netstandard1.0/Newtonsoft.Json.dll"",
        ""netstandard1.1"": ""ref/netstandard1.0/Newtonsoft.Json.dll"",
        ""netstandard1.2"": ""ref/netstandard1.0/Newtonsoft.Json.dll"",
        ""netstandard1.3"": ""ref/netstandard1.3/Newtonsoft.Json.dll"",
        ""netstandard1.4"": ""ref/netstandard1.3/Newtonsoft.Json.dll"",
        ""netstandard1.5"": ""ref/netstandard1.3/Newtonsoft.Json.dll"",
        ""netstandard1.6"": ""ref/netstandard1.3/Newtonsoft.Json.dll"",
        ""netstandard2.0"": ""ref/netstandard2.0/Newtonsoft.Json.dll"",
    },
    package = ""newtonsoft.json"",
    version = ""11.0.2"",
)

";
            var parser = new WorkspaceParser(data);
            var result = parser.Parse();

            Assert.Single(result);
            var entry = result.First();

            Assert.Equal("newtonsoft.json", entry.PackageIdentity.Id);
            Assert.Equal("11.0.2", entry.PackageIdentity.Version.ToString());
            Assert.Equal(2, entry.CoreLib.Count);
        }