예제 #1
0
        public void GetHashCode_ReturnsUniqueHash()
        {
            // ARRANGE
            ScannedFileHashComparer comparer = new ScannedFileHashComparer();

            byte[] fileHashOne = new byte[32];
            byte[] fileHashTwo = new byte[32];
            fileHashOne[0] = 0x01;
            fileHashOne[1] = 0x02;
            fileHashOne[2] = 0x03;
            fileHashOne[3] = 0x04;
            fileHashTwo[0] = 0x04;
            fileHashTwo[1] = 0x03;
            fileHashTwo[2] = 0x02;
            fileHashTwo[3] = 0x01;

            // ACT
            int hashOne = comparer.GetHashCode(fileHashOne);
            int hashTwo = comparer.GetHashCode(fileHashTwo);

            // ASSERT
            Assert.AreNotEqual(hashOne, hashTwo, "The two hash codes were equal when expected to be different");
        }
예제 #2
0
        public void GetHashCode_ArrayLessThanFourBytes_ReturnsInt()
        {
            // ARRANGE
            ScannedFileHashComparer comparer = new ScannedFileHashComparer();

            byte[] fileHash = new byte[2];
            fileHash[0] = 0x01;
            fileHash[1] = 0x02;

            // ACT
            int hashOne = comparer.GetHashCode(fileHash);

            // ASSERT (if no exception the test passes)
        }