Ejemplo n.º 1
0
        public void AddPeriod_Valid()
        {
            var period   = Period.FromMonths(1) + Period.FromDays(3);
            var adjuster = DateAdjusters.AddPeriod(period);
            var start    = new LocalDate(2019, 5, 4);

            Assert.AreEqual(new LocalDate(2019, 6, 7), start.With(adjuster));
        }
Ejemplo n.º 2
0
        public void WithDateAdjuster()
        {
            LocalDateTime  localDateTime = new LocalDateTime(1985, 10, 26, 1, 18);
            Offset         offset        = Offset.FromHours(-5);
            OffsetDateTime original      = new OffsetDateTime(localDateTime, offset);
            var            dateAdjuster  = DateAdjusters.AddPeriod(Period.FromYears(30));
            OffsetDateTime updated       = Snippet.For(original.With(dateAdjuster));

            Assert.AreEqual(
                new LocalDateTime(2015, 10, 26, 1, 18),
                updated.LocalDateTime);
            Assert.AreEqual(original.Offset, updated.Offset);
        }