Example #1
0
        public void TestNuspec()
        {
            var metaData = new PackageMetaData()
            {
                Id            = "Id1",
                Version       = "1.0.0.0",
                Title         = "Title",
                Author        = "Auth1",
                Owner         = "Owner1",
                Copyright     = "CP1",
                Desciption    = "Desc1",
                Tags          = "T1",
                ReleaseNotes  = "RN1",
                CustomLibrary = new List <string>()
                {
                    "A.exe"
                },
                CustomReference = new List <string>(),
            };

            var         nuspecDoc = new NuSpecDocument(projectADocument.Object, metaData);
            XmlDocument doc       = nuspecDoc.Generate().Result;

            Assert.IsNotNull(doc);
            CheckDependencies(doc);
            CheckReferences(doc, metaData);
            CheckContentFile(doc);
            CheckFiles(doc, metaData);
        }
Example #2
0
        public void TestNuspec_Content()
        {
            var metaData = new PackageMetaData()
            {
                Id            = "Id1",
                Version       = "1.0.0.0",
                Title         = "Title",
                Author        = "Auth1",
                Owner         = "Owner1",
                Copyright     = "CP1",
                Desciption    = "Desc1",
                Tags          = "T1",
                ReleaseNotes  = "RN1",
                CustomLibrary = new List <string>()
                {
                    "A.exe"
                },
                CustomReference = new List <string>(),
            };

            var         nuspecDoc = new NuSpecDocument(projectADocument.Object, metaData);
            XmlDocument doc       = nuspecDoc.Generate().Result;

            string expectedValue = @"<?xml version=""1.0"" encoding=""utf-8""?><package><metadata><id>Id1</id><version>1.0.0.0</version><title>Title</title><authors>Auth1</authors><owners>Owner1</owners><description>Desc1</description><releaseNotes>RN1</releaseNotes><copyright>CP1</copyright><tags>T1</tags><dependencies><group><dependency id=""PackageOne"" version=""1.0.0.0"" /><dependency id=""PackageTwo"" version=""2.0.0.0"" /><dependency id=""PackageThree"" version=""1.0.0.0"" /><dependency id=""PackageFour"" version=""3.0.0.0"" /><dependency id=""PackageFive"" version=""1.0.0.0"" /></group><group targetFramework=""net461""><dependency id=""PackageOne"" version=""1.0.0.0"" /><dependency id=""PackageTwo"" version=""2.0.0.0"" /><dependency id=""PackageThree"" version=""1.0.0.0"" /><dependency id=""PackageFour"" version=""3.0.0.0"" /><dependency id=""PackageFive"" version=""1.0.0.0"" /></group></dependencies><references><group><reference file=""B.dll"" /><reference file=""C.dll"" /></group><group targetFramework=""net461""><reference file=""B.dll"" /><reference file=""C.dll"" /></group></references><contentFiles><files include=""/any/any/Config/CNF.xml"" buildAction=""None"" copyToOutput=""true"" /><files include=""/any/any/Data/MyData.json"" buildAction=""None"" copyToOutput=""true"" /></contentFiles></metadata><files><file src=""bin\release\B.dll"" target=""ref\net461"" /><file src=""bin\release\C.dll"" target=""ref\net461"" /><file src=""bin\release\B.dll"" target=""lib\net461"" /><file src=""bin\release\C.dll"" target=""lib\net461"" /><file src=""bin\release\A.exe"" target=""lib\net461"" /><file src=""bin\release\Config\CNF.xml"" target=""contentFiles\any\any\Config\CNF.xml"" /><file src=""bin\release\Data\MyData.json"" target=""contentFiles\any\any\Data\MyData.json"" /></files></package>";

            Assert.AreEqual(doc.InnerXml, expectedValue);
        }