/// <summary>Apply a relative time token to the a UTC date for 2000-01-01 using a new <see cref="ArithmeticTimePlugin"/> instance, and return a string representation of the resulting date.</summary>
        /// <param name="value">The relative time multiplier.</param>
        /// <param name="unit">The relative time unit.</param>
        protected string TryApply(int value, RelativeTimeUnit unit)
        {
            DateTime  date   = new DateTime(2000, 1, 1);
            TimeToken token  = new TimeToken(ArithmeticTimePlugin.Key, null, value.ToString(CultureInfo.InvariantCulture), unit);
            DateTime? result = new ArithmeticTimePlugin().TryApply(token, date);

            return(TestHelpers.GetRepresentation(result));
        }
        public string Tokenize_CanLocalizeUnits(string format)
        {
            ArithmeticTimePlugin plugin = new ArithmeticTimePlugin();

            plugin.SupportedUnits["seconde"] = RelativeTimeUnit.Seconds;
            plugin.SupportedUnits["heure"]   = RelativeTimeUnit.Hours;
            plugin.SupportedUnits["jour"]    = RelativeTimeUnit.Days;
            plugin.SupportedUnits["semaine"] = RelativeTimeUnit.Weeks;
            plugin.SupportedUnits["mois"]    = RelativeTimeUnit.Months;
            plugin.SupportedUnits["an"]      = RelativeTimeUnit.Years;
            plugin.SupportedUnits["année"]   = RelativeTimeUnit.Years;
            return(this.Tokenize(plugin, format));
        }
        /*********
        ** Protected methods
        *********/
        /// <summary>Tokenize a date format using a new <see cref="ArithmeticTimePlugin"/> instance, and return a string representation of the resulting tokens.</summary>
        /// <param name="plugin">The plugin which to tokenize the string.</param>
        /// <param name="format">The relative time format.</param>
        protected string Tokenize(ArithmeticTimePlugin plugin, string format)
        {
            IEnumerable <TimeToken> tokens = plugin.Tokenize(format);

            return(TestHelpers.GetRepresentation(tokens));
        }