Beispiel #1
0
        public void TestAdd_BigInteger_MinMinus1Nsec_Overflow()
        {
            var @base   = new Timestamp(-9223372036854775808L, 0);
            var operand = -1;

            Assert.Throws <OverflowException>(() => @base.Add(operand));
        }
Beispiel #2
0
        public void TestAdd_TimeSpan_MinMinus1ick_Overflow()
        {
            var @base   = new Timestamp(-9223372036854775808L, 99);
            var operand = TimeSpan.FromTicks(-1);

            Assert.Throws <OverflowException>(() => @base.Add(operand));
        }
Beispiel #3
0
        public void TestAdd_BigInteger_MaxPlus1Nsec_Overflow()
        {
            var @base   = new Timestamp(9223372036854775807L, 999999999);
            var operand = 1;

            Assert.Throws <OverflowException>(() => @base.Add(operand));
        }
Beispiel #4
0
        public void TestAdd_TimeSpan_MaxPlus1Tick_Overflow()
        {
            var @base   = new Timestamp(9223372036854775807L, 999999900);
            var operand = TimeSpan.FromTicks(1);

            Assert.Throws <OverflowException>(() => @base.Add(operand));
        }
Beispiel #5
0
        public void TestAdd_TimeSpan_1Tick()
        {
            var @base   = new Timestamp(1L, 1);
            var operand = TimeSpan.FromTicks(1);
            var result  = @base.Add(operand);

            Assert.That(result.UnixEpochSecondsPart, Is.EqualTo(1));
            Assert.That(result.NanosecondsPart, Is.EqualTo(101));
        }
Beispiel #6
0
        public void TestAdd_BigInteger_MoveDown()
        {
            var @base   = new Timestamp(1L, 0);
            var operand = -2;
            var result  = @base.Add(operand);

            Assert.That(result.UnixEpochSecondsPart, Is.EqualTo(0));
            Assert.That(result.NanosecondsPart, Is.EqualTo(999999998));
        }
Beispiel #7
0
        public void TestAdd_BigInteger_MoveUp()
        {
            var @base   = new Timestamp(1L, 999999999);
            var operand = 2;
            var result  = @base.Add(operand);

            Assert.That(result.UnixEpochSecondsPart, Is.EqualTo(2));
            Assert.That(result.NanosecondsPart, Is.EqualTo(1));
        }
Beispiel #8
0
        public void TestAdd_BigInteger_Minus1Nsec()
        {
            var @base   = new Timestamp(1L, 1);
            var operand = -1;
            var result  = @base.Add(operand);

            Assert.That(result.UnixEpochSecondsPart, Is.EqualTo(1));
            Assert.That(result.NanosecondsPart, Is.EqualTo(0));
        }
Beispiel #9
0
        public void TestAdd_TimeSpan_MoveDown()
        {
            var @base   = new Timestamp(1L, 99);
            var operand = TimeSpan.FromTicks(-1);
            var result  = @base.Add(operand);

            Assert.That(result.UnixEpochSecondsPart, Is.EqualTo(0));
            Assert.That(result.NanosecondsPart, Is.EqualTo(999999999));
        }