Esempio n. 1
0
        public void Compares_On_Address_When_Size_Is_Equal()
        {
            var key1 = new ValueWithAddressIndexKey <int> {
                V = 1, A = 1
            };
            var key2 = new ValueWithAddressIndexKey <int> {
                V = 1, A = 2
            };

            Assert.IsTrue(key1.CompareTo(key2) < 0);
        }
Esempio n. 2
0
        public void Compares_On_Value_First()
        {
            var key1 = new ValueWithAddressIndexKey <int> {
                V = 1, A = 2
            };
            var key2 = new ValueWithAddressIndexKey <int> {
                V = 2, A = 1
            };

            Assert.IsTrue(key1.CompareTo(key2) < 0);
        }
Esempio n. 3
0
        public void Compares_DateTimes_With_Millisecond_Precision()
        {
            var date          = new DateTime(2017, 01, 01);
            var datePlus1Tick = new DateTime(date.Ticks + 1);
            var key1          = new ValueWithAddressIndexKey <DateTime> {
                V = date, A = 1
            };
            var key2 = new ValueWithAddressIndexKey <DateTime> {
                V = datePlus1Tick, A = 1
            };

            Assert.AreEqual(0, key1.CompareTo(key2));
        }
Esempio n. 4
0
        public void Considers_Equal_When_Address_Missing()
        {
            var key1 = new ValueWithAddressIndexKey <int> {
                V = 1, A = 1
            };
            var key2 = new ValueWithAddressIndexKey <int> {
                V = 1
            };

            Assert.AreEqual(0, key1.CompareTo(key2));
            Assert.AreEqual(0, key2.CompareTo(key1));
            Assert.IsTrue(key1.Equals(key2));
            Assert.IsTrue(key2.Equals(key1));
        }