Esempio n. 1
0
        public void CreateHtml_NullAndMaxVersions_AllVersions()
        {
            var creator = new ReleaseNotesCreator(null, History.Versions.Last());

            string html = creator.CreateHtml();

            // only in version list
            Version         version             = History.Versions.First();
            MatchCollection firstVersionMatches = Regex.Matches(html, version.ToString());

            firstVersionMatches.Count.Should().Be(1);

            // in introduction and version list
            version = History.Versions.Last();
            MatchCollection lastVersionMatches = Regex.Matches(html, version.ToString());

            lastVersionMatches.Count.Should().Be(2);

            firstVersionMatches[0].Index.Should().BeGreaterThan(lastVersionMatches[0].Index);

            // only in version list
            for (int i = 1; i < History.Versions.Length - 1; i++)
            {
                version = History.Versions[i];
                html.Should().Contain(version.ToString(), $"Version {version} is missing in HTML file");
            }
        }
        public void CreateHtml_NullAndMaxVersions_AllVersions()
        {
            var creator = new ReleaseNotesCreator(null, History.Versions.Last());

            string html = creator.CreateHtml();

            // only in version list
            Version version = History.Versions.First();
            MatchCollection firstVersionMatches = Regex.Matches(html, version.ToString());
            firstVersionMatches.Count.Should().Be(1);

            // in introduction and version list
            version = History.Versions.Last();
            MatchCollection lastVersionMatches = Regex.Matches(html, version.ToString());
            lastVersionMatches.Count.Should().Be(2);

            firstVersionMatches[0].Index.Should().BeGreaterThan(lastVersionMatches[0].Index);

            // only in version list
            for (int i = 1; i < History.Versions.Length - 1; i++)
            {
                version = History.Versions[i];
                html.Should().Contain(version.ToString(), $"Version {version} is missing in HTML file");
            }
        }
Esempio n. 3
0
        public void CreateHtml_MaxVersions_EmptyString()
        {
            var creator = new ReleaseNotesCreator(History.Versions.Last(), History.Versions.Last());

            string content = creator.CreateHtml();

            content.Should().BeEmpty();
        }
        public void CreateHtml_MaxVersions_EmptyString()
        {
            var creator = new ReleaseNotesCreator(History.Versions.Last(), History.Versions.Last());

            string content = creator.CreateHtml();

            content.Should().BeEmpty();
        }
        private void DisplayReleaseNotesIfNecessary()
        {
            var versionProvider = new VersionProvider(this);

            Version formerlyInstalledVersion = versionProvider.FormerlyInstalledVersion;
            Version currentVersion = versionProvider.CurrentVersion;

            versionProvider.UpdateLastVersion();

            if (!_generalOptions.ShowReleaseNotes
                || (formerlyInstalledVersion != null && formerlyInstalledVersion >= currentVersion))
                return;

            var creator = new ReleaseNotesCreator(formerlyInstalledVersion, currentVersion);
            DisplayReleaseNotes(creator.CreateHtml());
        }