public void GivenHistoryReleaseIsNullReleaseAndGitHubReleaseIsNullRelease_WhenIsNewAndShouldBeStoredIsCalled_ThenResultShouldBeFalse()
        {
            // Arrange
            const string repoName             = "repo";
            var          repoConfig           = RepositoryConfigurationBuilder.BuildOne(repoName);
            var          releasesFromGitHub   = RepositoryReleaseBuilder.BuildListContainingOneNullRelease <GitHubRepositoryRelease>(repoName);
            var          releasesFromHistory  = RepositoryReleaseBuilder.BuildListContainingOneNullRelease <HistoryRepositoryRelease>(repoName);
            var          releaseMatchFunction = ReleaseFunctionBuilder.BuildForMatchingRepositoryName();

            // Act
            var latestReleases = LatestObjectsBuilder.Build <RepositoryConfiguration, RepositoryRelease, LatestReleases>(
                repoConfig,
                releasesFromGitHub,
                releasesFromHistory,
                releaseMatchFunction);

            // Assert
            latestReleases.IsNewAndShouldBeStored.Should().BeFalse("because there is no result from GitHub");
        }
        public void GivenHistoryReleaseIsReleaseWithNonMatchingReleaseId_WhenIsNewAndShouldBeStoredIsCalled_ThenResultShouldBeTrue()
        {
            // Arrange
            const string repoName             = "repo";
            const int    releaseIdHistory     = 1;
            const int    releaseIdGithub      = 2;
            var          repoConfig           = RepositoryConfigurationBuilder.BuildOne(repoName);
            var          releasesFromGitHub   = RepositoryReleaseBuilder.BuildListContainingOneWithReleaseId <GitHubRepositoryRelease>(repoName, releaseIdGithub);
            var          releasesFromHistory  = RepositoryReleaseBuilder.BuildListContainingOneWithReleaseId <HistoryRepositoryRelease>(repoName, releaseIdHistory);
            var          releaseMatchFunction = ReleaseFunctionBuilder.BuildForMatchingRepositoryName();

            // Act
            var latestReleases = LatestObjectsBuilder.Build <RepositoryConfiguration, RepositoryRelease, LatestReleases>(
                repoConfig,
                releasesFromGitHub,
                releasesFromHistory,
                releaseMatchFunction);

            // Assert
            latestReleases.IsNewAndShouldBeStored.Should().BeTrue("because the releaseIds are not equal");
        }
        public void GivenHistoryReleaseIsNullReleaseAndGitHubReleaseIsWithinTimeWindow_WhenIsNewAndShouldBePostedIsCalled_ThenResultShouldBeTrue()
        {
            // Arrange
            const string repoName             = "repo";
            const int    releaseIdGithub      = 1;
            var          daysTimespan         = new TimeSpan(1, 0, 0, 0);
            var          gitHubReleaseDate    = DateTimeOffset.UtcNow.Subtract(daysTimespan);
            var          repoConfig           = RepositoryConfigurationBuilder.BuildOne(repoName);
            var          releasesFromGitHub   = RepositoryReleaseBuilder.BuildListContainingOneWithReleaseIdAndDate <GitHubRepositoryRelease>(repoName, releaseIdGithub, gitHubReleaseDate);
            var          releasesFromHistory  = RepositoryReleaseBuilder.BuildListContainingOneNullRelease <HistoryRepositoryRelease>(repoName);
            var          releaseMatchFunction = ReleaseFunctionBuilder.BuildForMatchingRepositoryName();

            // Act
            var latestReleases = LatestObjectsBuilder.Build <RepositoryConfiguration, RepositoryRelease, LatestReleases>(
                repoConfig,
                releasesFromGitHub,
                releasesFromHistory,
                releaseMatchFunction);

            // Assert
            latestReleases.IsNewAndShouldBeStored.Should().BeTrue("because the release is not in history yet.");
            latestReleases.IsNewAndShouldBePosted.Should().BeTrue($"because the release date is within the time window of {LatestReleases.MaximumNumberOfDaysToPostAboutNewlyFoundRelease} days");
        }