Esempio n. 1
0
        public void PdfIntegerClass_GetHashCodeMethod_ReturnsSameValueWhenCalledTwiceOnSameObject()
        {
            int        testObjectValue = _rnd.Next(int.MinValue, int.MaxValue);
            PdfInteger testObject      = new PdfInteger(testObjectValue);

            int testOutput0 = testObject.GetHashCode();
            int testOutput1 = testObject.GetHashCode();

            Assert.AreEqual(testOutput0, testOutput1);
        }
Esempio n. 2
0
        public void PdfIntegerClass_GetHashCodeMethod_ProbablyReturnsDifferentValueWhenCalledOnObjectsWithDifferentValue()
        {
            for (int i = 0; i < 1_000_000; ++i)
            {
                int testObjectValue0 = _rnd.Next(int.MinValue, int.MaxValue);
                int testObjectValue1;
                do
                {
                    testObjectValue1 = _rnd.Next(int.MinValue, int.MaxValue);
                } while (testObjectValue1 == testObjectValue0);
                PdfInteger testObject0 = new PdfInteger(testObjectValue0);
                PdfInteger testObject1 = new PdfInteger(testObjectValue1);

                int testOutput0 = testObject0.GetHashCode();
                int testOutput1 = testObject1.GetHashCode();

                Assert.AreNotEqual(testOutput0, testOutput1);
            }
        }