Ejemplo n.º 1
0
        public void CkanUpdate_NormalUpdate_ParsedCorrectly()
        {
            // Arrange
            const string releaseJSON = @"{
                ""name"": ""Wallops"",
                ""tag_name"": ""v1.25.0"",
                ""assets"": [ {
                    ""size"": 414208,
                    ""browser_download_url"": ""https://github.com/KSP-CKAN/CKAN/releases/download/v1.25.0/AutoUpdater.exe""
                }, {
                    ""size"": 6789120,
                    ""browser_download_url"": ""https://github.com/KSP-CKAN/CKAN/releases/download/v1.25.0/CKAN.dmg""
                }, {
                    ""size"": 6651392,
                    ""browser_download_url"": ""https://github.com/KSP-CKAN/CKAN/releases/download/v1.25.0/ckan.exe""
                }, {
                    ""size"": 660764,
                    ""browser_download_url"": ""https://github.com/KSP-CKAN/CKAN/releases/download/v1.25.0/ckan_1.25.0_all.deb""
                } ],
                ""body"": ""[![](https://upload.wikimedia.org/wikipedia/commons/thumb/2/24/NASA_Wallops_Flight_Facility%2C_2010.jpg/780px-NASA_Wallops_Flight_Facility%2C_2010.jpg)](https://en.wikipedia.org/wiki/Wallops_Flight_Facility)\r\n\r\n---\r\nGreatest release notes of all time""
            }";

            // Act
            CkanUpdate cu = new CkanUpdate(releaseJSON);

            // Assert
            Assert.AreEqual(new CkanModuleVersion("v1.25.0", "Wallops"), cu.Version);
            Assert.AreEqual("https://github.com/KSP-CKAN/CKAN/releases/download/v1.25.0/ckan.exe", cu.ReleaseDownload.ToString());
            Assert.AreEqual(6651392, cu.ReleaseSize);
            Assert.AreEqual("https://github.com/KSP-CKAN/CKAN/releases/download/v1.25.0/AutoUpdater.exe", cu.UpdaterDownload.ToString());
            Assert.AreEqual(414208, cu.UpdaterSize);
            Assert.AreEqual("Greatest release notes of all time", cu.ReleaseNotes);
        }
Ejemplo n.º 2
0
 public void ExtractReleaseNotes(string body, string expected, string comment)
 {
     Assert.AreEqual(
         expected,
         CkanUpdate.ExtractReleaseNotes(body),
         comment
         );
 }