// No tests for non-ISO-day-of-week calendars as we don't have any yet.

        public void Operator_MethodEquivalents()
        {
            LocalDateTime start  = new LocalDateTime(2011, 1, 1, 15, 25, 30, 100, 5000);
            Period        period = Period.FromHours(1) + Period.FromDays(1);

            Assert.AreEqual(start + period, LocalDateTime.Add(start, period));
            Assert.AreEqual(start + period, start.Plus(period));
            Assert.AreEqual(start - period, LocalDateTime.Subtract(start, period));
            Assert.AreEqual(start - period, start.Minus(period));
        }
Esempio n. 2
0
        public void Operator_MethodEquivalents()
        {
            LocalDateTime start  = new LocalDateTime(2011, 1, 1, 15, 25, 30).PlusNanoseconds(123456789);
            Period        period = Period.FromHours(1) + Period.FromDays(1);
            LocalDateTime end    = start + period;

            Assert.AreEqual(start + period, LocalDateTime.Add(start, period));
            Assert.AreEqual(start + period, start.Plus(period));
            Assert.AreEqual(start - period, LocalDateTime.Subtract(start, period));
            Assert.AreEqual(start - period, start.Minus(period));
            Assert.AreEqual(period, end - start);
            Assert.AreEqual(period, LocalDateTime.Subtract(end, start));
            Assert.AreEqual(period, end.Minus(start));
        }
Esempio n. 3
0
 /// <summary>
 /// Decrease time
 /// </summary>
 /// <param name="ldt"></param>
 /// <param name="toSubtract"></param>
 /// <returns></returns>
 public static LocalDateTime DecreaseTime(this LocalDateTime ldt, TimeSpan toSubtract) => ldt.Add(-toSubtract);
Esempio n. 4
0
 /// <summary>
 /// Increase time
 /// </summary>
 /// <param name="ldt"></param>
 /// <param name="toAdd"></param>
 /// <returns></returns>
 public static LocalDateTime IncreaseTime(this LocalDateTime ldt, TimeSpan toAdd) => ldt.Add(toAdd);