public void TestGetFormatInfo_null() { NodaFormatInfo.ClearCache(); Assert.Throws <ArgumentNullException>(() => NodaFormatInfo.GetFormatInfo(null)); }
/// <summary> /// Creates a pattern for the given pattern text and culture. /// </summary> /// <remarks> /// See the user guide for the available pattern text options. /// </remarks> /// <param name="patternText">Pattern text to create the pattern for</param> /// <param name="cultureInfo">The culture to use in the pattern</param> /// <returns>A pattern for parsing and formatting instants.</returns> /// <exception cref="InvalidPatternException">The pattern text was invalid.</exception> public static InstantPattern Create(string patternText, CultureInfo cultureInfo) { return(Create(patternText, NodaFormatInfo.GetFormatInfo(cultureInfo))); }
/// <summary> /// Creates a pattern for the given pattern text, culture, resolver, time zone provider, and template value. /// </summary> /// <remarks> /// See the user guide for the available pattern text options. /// If <paramref name="zoneProvider"/> is null, the resulting pattern can be used for formatting /// but not parsing. /// </remarks> /// <param name="patternText">Pattern text to create the pattern for</param> /// <param name="cultureInfo">The culture to use in the pattern</param> /// <param name="resolver">Resolver to apply when mapping local date/time values into the zone.</param> /// <param name="zoneProvider">Time zone provider, used when parsing text which contains a time zone identifier.</param> /// <param name="templateValue">Template value to use for unspecified fields</param> /// <returns>A pattern for parsing and formatting zoned date/times.</returns> /// <exception cref="InvalidPatternException">The pattern text was invalid.</exception> [NotNull] public static ZonedDateTimePattern Create([NotNull] string patternText, [NotNull] CultureInfo cultureInfo, [CanBeNull] ZoneLocalMappingResolver resolver, [CanBeNull] IDateTimeZoneProvider zoneProvider, ZonedDateTime templateValue) => Create(patternText, NodaFormatInfo.GetFormatInfo(cultureInfo), resolver, zoneProvider, templateValue);
/// <summary> /// Creates a pattern for the given pattern text, culture, and template value. /// </summary> /// <remarks> /// See the user guide for the available pattern text options. /// </remarks> /// <param name="patternText">Pattern text to create the pattern for</param> /// <param name="cultureInfo">The culture to use in the pattern</param> /// <param name="templateValue">Template value to use for unspecified fields</param> /// <returns>A pattern for parsing and formatting local dates.</returns> /// <exception cref="InvalidPatternException">The pattern text was invalid.</exception> public static LocalDatePattern Create([NotNull] string patternText, [NotNull] CultureInfo cultureInfo, LocalDate templateValue) => Create(patternText, NodaFormatInfo.GetFormatInfo(cultureInfo), templateValue);
/// <summary> /// Creates a pattern for the given pattern text and culture. /// </summary> /// <remarks> /// See the user guide for the available pattern text options. /// </remarks> /// <param name="patternText">Pattern text to create the pattern for</param> /// <param name="cultureInfo">The culture to use in the pattern</param> /// <returns>A pattern for parsing and formatting offsets.</returns> /// <exception cref="InvalidPatternException">The pattern text was invalid.</exception> public static DurationPattern Create([NotNull] string patternText, [NotNull] CultureInfo cultureInfo) => Create(patternText, NodaFormatInfo.GetFormatInfo(cultureInfo));
/// <summary> /// Creates a pattern for the same original pattern text as this pattern, but with the specified /// culture. /// </summary> /// <param name="cultureInfo">The culture to use in the new pattern.</param> /// <returns>A new pattern with the given culture.</returns> public LocalTimePattern WithCulture(CultureInfo cultureInfo) => WithFormatInfo(NodaFormatInfo.GetFormatInfo(cultureInfo));
/// <summary> /// Creates a pattern for the same original pattern text as this pattern, but with the specified /// culture. /// </summary> /// <param name="cultureInfo">The culture to use in the new pattern.</param> /// <returns>A new pattern with the given culture.</returns> public OffsetPattern WithCulture(CultureInfo cultureInfo) => Create(PatternText, NodaFormatInfo.GetFormatInfo(cultureInfo));
/// <summary> /// Creates a pattern for the given pattern text, culture, and template value. /// </summary> /// <remarks> /// See the user guide for the available pattern text options. /// </remarks> /// <param name="patternText">Pattern text to create the pattern for</param> /// <param name="cultureInfo">The culture to use in the pattern</param> /// <param name="templateValue">Template value to use for unspecified fields</param> /// <returns>A pattern for parsing and formatting year/months.</returns> /// <exception cref="InvalidPatternException">The pattern text was invalid.</exception> public static YearMonthPattern Create(string patternText, [ValidatedNotNull] CultureInfo cultureInfo, YearMonth templateValue) => Create(patternText, NodaFormatInfo.GetFormatInfo(cultureInfo), templateValue);
/// <summary> /// Creates a pattern for the same original pattern text as this pattern, but with the specified /// culture. /// </summary> /// <param name="cultureInfo">The culture to use in the new pattern.</param> /// <returns>A new pattern with the given culture.</returns> public YearMonthPattern WithCulture([ValidatedNotNull] CultureInfo cultureInfo) => WithFormatInfo(NodaFormatInfo.GetFormatInfo(cultureInfo));
public void TestEraGetEraPrimaryName_Null() { var info = NodaFormatInfo.GetFormatInfo(enUs); Assert.Throws <ArgumentNullException>(() => info.GetEraPrimaryName(null)); }
public void ConvertCulture(CultureInfo culture) { NodaFormatInfo.GetFormatInfo(culture); }
public void TestGetEraPrimaryName_NoSuchEra() { var info = NodaFormatInfo.GetFormatInfo(enUs); Assert.AreEqual("", info.GetEraPrimaryName(new Era("Ignored", "NonExistantResource"))); }
public void TestGetEraPrimaryName() { var info = NodaFormatInfo.GetFormatInfo(enUs); Assert.AreEqual("B.C.", info.GetEraPrimaryName(Era.BeforeCommon)); }
public void TestGetEraNames_NoSuchEra() { var info = NodaFormatInfo.GetFormatInfo(enUs); Assert.AreEqual(0, info.GetEraNames(new Era("Ignored", "NonExistantResource")).Count); }
/// <summary> /// Creates a pattern for the same original pattern text as this pattern, but with the specified /// culture. /// </summary> /// <param name="cultureInfo">The culture to use in the new pattern.</param> /// <returns>A new pattern with the given culture.</returns> public OffsetDatePattern WithCulture(CultureInfo cultureInfo) => WithFormatInfo(NodaFormatInfo.GetFormatInfo(cultureInfo));
/// <summary> /// Creates a pattern for the given pattern text, culture, resolver, time zone provider, and template value. /// </summary> /// <remarks> /// See the user guide for the available pattern text options. /// If <paramref name="zoneProvider"/> is null, the resulting pattern can be used for formatting /// but not parsing. /// </remarks> /// <param name="patternText">Pattern text to create the pattern for</param> /// <param name="cultureInfo">The culture to use in the pattern</param> /// <param name="resolver">Resolver to apply when mapping local date/time values into the zone.</param> /// <param name="zoneProvider">Time zone provider, used when parsing text which contains a time zone identifier.</param> /// <param name="templateValue">Template value to use for unspecified fields</param> /// <returns>A pattern for parsing and formatting zoned date/times.</returns> /// <exception cref="InvalidPatternException">The pattern text was invalid.</exception> public static ZonedDateTimePattern Create(string patternText, CultureInfo cultureInfo, ZoneLocalMappingResolver resolver, IDateTimeZoneProvider zoneProvider, ZonedDateTime templateValue) { return(Create(patternText, NodaFormatInfo.GetFormatInfo(cultureInfo), resolver, zoneProvider, templateValue)); }
/// <summary> /// Creates a pattern for the given pattern text, culture, and template value. /// </summary> /// <remarks> /// See the user guide for the available pattern text options. /// </remarks> /// <param name="patternText">Pattern text to create the pattern for</param> /// <param name="cultureInfo">The culture to use in the pattern</param> /// <param name="templateValue">Template value to use for unspecified fields</param> /// <returns>A pattern for parsing and formatting local times.</returns> /// <exception cref="InvalidPatternException">The pattern text was invalid.</exception> public static LocalTimePattern Create(string patternText, CultureInfo cultureInfo, LocalTime templateValue) => Create(patternText, NodaFormatInfo.GetFormatInfo(cultureInfo), templateValue);
/// <summary> /// Creates a pattern for the same original pattern text as this pattern, but with the specified /// culture. /// </summary> /// <param name="cultureInfo">The culture to use in the new pattern.</param> /// <returns>A new pattern with the given culture.</returns> public ZonedDateTimePattern WithCulture(CultureInfo cultureInfo) { return(WithFormatInfo(NodaFormatInfo.GetFormatInfo(cultureInfo))); }
/// <summary> /// Creates a pattern for the given pattern text and culture. /// </summary> /// <remarks> /// See the user guide for the available pattern text options. /// </remarks> /// <param name="patternText">Pattern text to create the pattern for</param> /// <param name="cultureInfo">The culture to use in the pattern</param> /// <returns>A pattern for parsing and formatting offsets.</returns> /// <exception cref="InvalidPatternException">The pattern text was invalid.</exception> public static OffsetPattern Create(string patternText, CultureInfo cultureInfo) => Create(patternText, NodaFormatInfo.GetFormatInfo(cultureInfo));
/// <summary> /// Creates a pattern for the same original pattern text as this pattern, but with the specified /// culture. /// </summary> /// <param name="cultureInfo">The culture to use in the new pattern.</param> /// <returns>A new pattern with the given culture.</returns> public InstantPattern WithCulture([NotNull] CultureInfo cultureInfo) => WithFormatInfo(NodaFormatInfo.GetFormatInfo(cultureInfo));
/// <summary> /// Creates a pattern for the given pattern text, culture, and template value. /// </summary> /// <remarks> /// See the user guide for the available pattern text options. /// </remarks> /// <param name="patternText">Pattern text to create the pattern for</param> /// <param name="cultureInfo">The culture to use in the pattern</param> /// <param name="templateValue">Template value to use for unspecified fields</param> /// <returns>A pattern for parsing and formatting local date/times.</returns> /// <exception cref="InvalidPatternException">The pattern text was invalid.</exception> [NotNull] public static OffsetDateTimePattern Create([NotNull] string patternText, [NotNull] CultureInfo cultureInfo, OffsetDateTime templateValue) => Create(patternText, NodaFormatInfo.GetFormatInfo(cultureInfo), templateValue);
/// <summary> /// Creates a pattern for the same original pattern text as this pattern, but with the specified /// culture. /// </summary> /// <param name="cultureInfo">The culture to use in the new pattern.</param> /// <returns>A new pattern with the given culture.</returns> public OffsetDatePattern WithCulture([ValidatedNotNull] CultureInfo cultureInfo) => WithFormatInfo(NodaFormatInfo.GetFormatInfo(cultureInfo));
/// <summary> /// Creates a pattern for the same original pattern text as this pattern, but with the specified /// culture. /// </summary> /// <param name="cultureInfo">The culture to use in the new pattern.</param> /// <returns>A new pattern with the given culture.</returns> public LocalDatePattern WithCulture([NotNull] CultureInfo cultureInfo) => WithFormatInfo(NodaFormatInfo.GetFormatInfo(cultureInfo));
/// <summary> /// Creates a pattern for the given pattern text, culture, and template value. /// </summary> /// <remarks> /// See the user guide for the available pattern text options. /// </remarks> /// <param name="patternText">Pattern text to create the pattern for</param> /// <param name="cultureInfo">The culture to use in the pattern</param> /// <param name="templateValue">Template value to use for unspecified fields</param> /// <returns>A pattern for parsing and formatting local dates.</returns> /// <exception cref="InvalidPatternException">The pattern text was invalid.</exception> public static LocalDatePattern Create(string patternText, CultureInfo cultureInfo, LocalDate templateValue) { return(Create(patternText, NodaFormatInfo.GetFormatInfo(cultureInfo), templateValue)); }
/// <summary> /// Creates a pattern for the same original pattern text as this pattern, but with the specified /// culture. /// </summary> /// <param name="cultureInfo">The culture to use in the new pattern.</param> /// <returns>A new pattern with the given culture.</returns> public DurationPattern WithCulture([NotNull] CultureInfo cultureInfo) => Create(PatternText, NodaFormatInfo.GetFormatInfo(cultureInfo));
/// <summary> /// Creates a pattern for the same original pattern text as this pattern, but with the specified /// culture. /// </summary> /// <param name="cultureInfo">The culture to use in the new pattern.</param> /// <returns>A new pattern with the given culture.</returns> public LocalDatePattern WithCulture(CultureInfo cultureInfo) { return(WithFormatInfo(NodaFormatInfo.GetFormatInfo(cultureInfo))); }
/// <summary> /// Creates a pattern for the same original pattern text as this pattern, but with the specified /// culture. /// </summary> /// <param name="cultureInfo">The culture to use in the new pattern.</param> /// <returns>A new pattern with the given culture.</returns> public InstantPattern WithCulture(CultureInfo cultureInfo) { return(WithFormatInfo(NodaFormatInfo.GetFormatInfo(cultureInfo))); }
/// <summary> /// Creates a pattern for the given pattern text, culture, and template value. /// </summary> /// <remarks> /// See the user guide for the available pattern text options. /// </remarks> /// <param name="patternText">Pattern text to create the pattern for</param> /// <param name="cultureInfo">The culture to use in the pattern</param> /// <param name="templateValue">Template value to use for unspecified fields</param> /// <returns>A pattern for parsing and formatting local dates.</returns> /// <exception cref="InvalidPatternException">The pattern text was invalid.</exception> public static OffsetDatePattern Create(string patternText, CultureInfo cultureInfo, OffsetDate templateValue) => Create(patternText, NodaFormatInfo.GetFormatInfo(cultureInfo), templateValue);
/// <summary> /// Creates a pattern for the same original pattern text as this pattern, but with the specified /// culture. /// </summary> /// <param name="cultureInfo">The culture to use in the new pattern.</param> /// <returns>A new pattern with the given culture.</returns> [NotNull] public ZonedDateTimePattern WithCulture([NotNull] CultureInfo cultureInfo) => WithFormatInfo(NodaFormatInfo.GetFormatInfo(cultureInfo));
/// <summary> /// Creates a pattern for the same original pattern text as this pattern, but with the specified /// culture. /// </summary> /// <param name="cultureInfo">The culture to use in the new pattern.</param> /// <returns>A new pattern with the given culture.</returns> public YearMonthPattern WithCulture(CultureInfo cultureInfo) => WithFormatInfo(NodaFormatInfo.GetFormatInfo(cultureInfo));