public void EraName() { CultureInfo en_US = new CultureInfo("en-US"); DateTimeFormatInfo dtfi = en_US.DateTimeFormat; Assert.AreEqual("AD", dtfi.GetAbbreviatedEraName(0), "#1"); Assert.AreEqual("A.D.", dtfi.GetEraName(1), "#2"); Assert.AreEqual(1, dtfi.GetEra("A.D."), "#3"); Assert.AreEqual(1, dtfi.GetEra("AD"), "#4"); Assert.AreEqual(-1, dtfi.GetEra("C.E"), "#5"); Assert.AreEqual(-1, dtfi.GetEra("Common Era"), "#6"); }
private void VerificationHelper(DateTimeFormatInfo info, string eraName, int expected) { int actual = info.GetEra(eraName); Assert.Equal(expected, actual); }
public void GetEra(DateTimeFormatInfo format, string eraName, int expected) { Assert.Equal(expected, format.GetEra(eraName)); }
public void GetEra_NullEraName_ThrowsArgumentNullException() { var format = new DateTimeFormatInfo(); AssertExtensions.Throws <ArgumentNullException>("eraName", () => format.GetEra(null)); }