Example #1
0
        public void WithAdjuster()
        {
            var initial  = new OffsetDate(new LocalDate(2016, 6, 19), Offset.FromHours(-5));
            var actual   = initial.With(DateAdjusters.StartOfMonth);
            var expected = new OffsetDate(new LocalDate(2016, 6, 1), Offset.FromHours(-5));

            Assert.AreEqual(expected, actual);
        }
Example #2
0
        public void With()
        {
            var original = new OffsetDate(
                new LocalDate(2019, 5, 3),
                Offset.FromHours(3));

            Func <LocalDate, LocalDate> tomorrowAdjuster = x => x + Period.FromDays(1);
            OffsetDate updated = Snippet.For(original.With(tomorrowAdjuster));

            Assert.AreEqual(original.Offset, updated.Offset);
            Assert.AreEqual(tomorrowAdjuster(original.Date), updated.Date);
        }