Exemple #1
0
        public void Addition_Subtraction(int leftDays, long leftNanos,
                                         int rightDays, long rightNanos,
                                         int resultDays, long resultNanos)
        {
            var left = new Duration(leftDays, leftNanos);
            var right = new Duration(rightDays, rightNanos);
            var result = new Duration(resultDays, resultNanos);

            Assert.AreEqual(result, left + right);
            Assert.AreEqual(result, left.Plus(right));
            Assert.AreEqual(result, Duration.Add(left, right));

            Assert.AreEqual(left, result - right);
            Assert.AreEqual(left, result.Minus(right));
            Assert.AreEqual(left, Duration.Subtract(result, right));
        }