コード例 #1
0
        public void CreateWithTemplateValue()
        {
            // This is testing the Create call specifying the template directly, instead of the WithTemplate method
            var template = new YearMonth(2000, 6);
            var pattern  = YearMonthPattern.Create("yyyy", CultureInfo.InvariantCulture, template);

            Assert.AreEqual(template, pattern.TemplateValue);
            var parseResult = pattern.Parse("1990");

            Assert.True(parseResult.Success);
            Assert.AreEqual(new YearMonth(1990, 6), parseResult.Value);
        }
コード例 #2
0
        public void CreateWithSpecificCulture()
        {
            var pattern = YearMonthPattern.Create("yyyy/MM", Cultures.FrCa);

            Assert.AreEqual("2017-08", pattern.Format(new YearMonth(2017, 8)));
        }