public void Matches_and_tournaments_text_matches_filter(bool includeMatches, bool includeTournaments)
        {
            var filter = new MatchFilter {
                IncludeMatches = includeMatches, IncludeTournaments = includeTournaments
            };
            var dateTimeFormatter = new Mock <IDateTimeFormatter>();
            var humanizer         = new MatchFilterHumanizer(dateTimeFormatter.Object);

            var result = humanizer.MatchesAndTournaments(filter);

            if (includeMatches)
            {
                Assert.Contains("matches", result, StringComparison.OrdinalIgnoreCase);
            }
            else
            {
                Assert.DoesNotContain("matches", result, StringComparison.OrdinalIgnoreCase);
            }

            if (includeTournaments)
            {
                Assert.Contains("tournaments", result, StringComparison.OrdinalIgnoreCase);
            }
            else
            {
                Assert.DoesNotContain("tournaments", result, StringComparison.OrdinalIgnoreCase);
            }
        }
        public void No_filter_returns_empty_string()
        {
            var filter            = new MatchFilter();
            var dateTimeFormatter = new Mock <IDateTimeFormatter>();
            var humanizer         = new MatchFilterHumanizer(dateTimeFormatter.Object);

            var result = humanizer.MatchingFilter(filter);

            Assert.Equal(string.Empty, result);
        }
        public void UntilDate_is_humanized()
        {
            var filter = new MatchFilter {
                UntilDate = DateTimeOffset.Now
            };
            var dateTimeFormatter = new Mock <IDateTimeFormatter>();

            dateTimeFormatter.Setup(x => x.FormatDate(filter.UntilDate.Value, false, true, false)).Returns(filter.UntilDate.Value.ToString("d", CultureInfo.CurrentCulture));
            var humanizer = new MatchFilterHumanizer(dateTimeFormatter.Object);

            var result = humanizer.MatchingFilter(filter);

            dateTimeFormatter.Verify(x => x.FormatDate(filter.UntilDate.Value, false, true, false), Times.Once);
            Assert.Equal(result, " up to " + filter.UntilDate.Value.ToString("d", CultureInfo.CurrentCulture));
        }